Counting the Use of tags in an osm2pgsql database.

Earlier this week, I was talking with a friend who just moved from Massachusetts to Cleveland, they were a bit surprised about the use of middle school and junior high were both used to describe schools consisting of Grades 6-8.

I was curious about this myself and wondered which was used more often in Ohio and this general outline that I use for counting the use of middle school and junior high in ohio can be used applied if you want to see which tag is used more often in a specific state, country, or other place.

Of course, there’s multiple ways to do this and I wish there an easier way but here’s what a I did….

Because I was comparing 2 tags within an entire state, I couldn’t use the USA implementation of taginfo which uses the entire USA, and I couldn’t open an OSM file containing the entire state of ohio in an osm editor like josm..

So, for my state of ohio, I figured this answer out by:

1. downloading an extract of my state from geofabrik.

  1. Create the postgis database (I have ubuntu 12.04, postgis 2.0, postgresql 9.1, I assume you already have this installed; commands are different if you’re using postgis 1.5… I should explain this step out more clearly in a different post since I never found good introductory documentation for postgis/postgresql/osm when I first starting learning this back in ’11.)

2a. createdb nameofyourdatabase
2.b psql -d nameofyourdatabase -c “CREATE EXTENSION postgis;”

 

3. Fill your database with the OSM data through the osm2pgsql software by the following command: osm2pgsql -s -d nameofyourdb ~/path/to/data.osm.pbf

  1. Using pgadmin, with the gui, I connected to my database and I clicked on magnifying glass with SQL within it and entered the following SQL. input the following SQL:

SELECT name from planet_osm_polygon WHERE lower(name) ~ ‘junior high’ UNION ALL select name from planet_osm_point WHERE lower(name) ~ ‘junior high’ ORDER BY name

(thanks to Paul Norman to assist me with the proper SQL query syntax).

SELECT name from planet_osm_polygon WHERE lower(name) ~ ‘junior high’
this means is that I selected all closed ways that has the name ‘junior high’ in it (case insensitive).

Now here’s what the finer points of what syntax means:
* name – This is the column ‘name’. Now, osm2pgsql creates columns based on the first half, also called the ‘key’, of an osm tag. Osm tags are written out as key=value

Other columns generated by your osm2pgsql include highway, amenity, leisure, and many more. Because it’s highly unlikely that there’s a store named junior high and the sake of simplicity, I didn’t need to specify that a tag must have amenity=school and have junior high in its name.

  • planet_osm_polygon – This is the name of a table in osm2pgsql that contains all closed ways. Here’s the names of the other tables in osm2pgsql.
  • WHERE – specifies the condition in which I want to select the name table. If I wanted to query a simple tag that has a standard key and value, like amenity=parking ; I could simplify do WHERE amenity IN (‘parking’). But since ‘junior high’ occurs in the middle of a text phrase, the tilde (known as ~) will search for the pattern ‘junior high’ within the tag value.

So, this will return results for: name=Mooney Junior High School; name=Junior High School; name=wilkens junior high ; regardless of case sensitivity. (I admit I don’t fully understand this aspect of the syntax, so someone clarify if I’m incorrect !)

  • UNION ALL – this allows you to do multiple queries within one and include the results of both queries at once .

select name from planet_osm_point WHERE lower(name) ~ ‘junior high’ ORDER BY name

Because OSM objects can be tagged as either nodes or as ways, I need to also search for any nodes that have junior high in its name ! The name of the nodes’ table is planet_osm_point and the structure of the syntax is nearly the same.

  • ORDER BY – this is simple, it merely sorts the results by a column. In this instance, I want to sort them in alphabetical order, so I did ORDER BY name.

Now, we can execute our query by clicking “Execute query” (its icon looks like a play button on a DVD/VCR),

Now in pgadmin’s lower-right hand corner, will be the number of results that are returned and the names of all of the schools with junior high in it…

So, we see: 219 of Junior High in Ohio ! There’s a few duplicate ones, which is interesting. Some may be the same name in 2 different places, some may be duplicate nodes of the same school.

And we repeat the process again for middle school, and… 389 !

Middle school is used more often in Ohio than in Junior High… :)

As you continue using osm2pgsql and working with OSM data, you’ll realize that if you are interested in generated statistics of tags or creating maps using postgresql in OSM data, most of your interaction with postgresql will be creating queries and using SELECT statements. You’ll want to guide your learning on that.

Advertisements

A day in the life as A HOT junior Coordinator (teaching OSM in Haiti)

(This was originally published on July 9, 2013 on OpenStreetMap Diaries).

While in Limonade, Haiti for 6 weeks, April 30 – June 22, I was a part of HOT’s project, in partnership with the Universite d’Etat Haiti and USAID, to help teach mapping and OSM skills to 60 mappers and establish an OSM community in Northern Haiti. Here’s a snapshot of what a typical (although most days were not typical, this was a typical as it was) day consisted of.

Follow along with this umap

For photos, check out these flickr sets: One and Two

6:45a – Shower with water from the house well, dressed, breakfast. The 15 housemates – 12 Advanced Mappers, two local coordinators, and 3 other HOT coordinators – begin to wake up within the hour. Read and reply to new emails.
Also used this time to learn python, thanks to Zed Shaw’s Learn Python the Hard Way

8:10 All 16 of us – 12 Advanced Mappers, two local coordinators, and 4 HOT coordinators pile into 2 vans to the Universite d’Etat d’Haiti’s Computer lab where we worked out of for the majority of our time there. The 12 advanced mappers and the 2 local coordinators were participants in last year’s St. Marc project and were relatively experienced with editing in OSM.

We established a system with 6 teams consisting of 2 Advanced mappers who supervised 10 novice mappers (participants whom had not edited OSM before they were hired at the beginning of the program in March) whose daily activities would rotate every 3 days. Each day, 2 teams would spend their day in the field surveying, 2 other teams remained at the computer lab, tracing buildings in anticipation of the following day’s field surveying or adding POIs that they recorded via GPS traces during their field surveys, and the remaining 2 teams’ novice mappers were off. The 4 advanced mappers of the team off would assist at the computer lab and continue editing. As necessary, we’d hold workshop days where all 60 mappers were in attendance for workshops and presentations on QGIS, and cartography and GIS concepts.

8:25 Our day at the university begins in the computer lab. !

The advanced mappers print out field papers and set up the equipment, gps, laptops for the day. Our 40 novice mappers would be arriving for the day at 9:00. I’d cross my fingers for the internet at the university to be functional for the day. As the 1,800 studens began to arrive for classes at the university, the internet slows to a crawl.

Throughout the day, I troubleshooted whether the current technical troubles, usually mappers unable to load bing imagery or map data from OSM, or upload changesets in JOSM, was caused by any problems within the local network on our end and if anything, what I could do to fix it.

Besides the on-site tech support, I’d help mappers by answering questions about what tags to use for features (for example, a window factory, a video arcade, driving school), basic josm usage, and other OSM related editing questions.

The project also focused on improving how HOT can more effective display and classify OSM data within the contexts of Haiti, other lesser developed areas, and in humanitarian contexts. During the day, I also worked on the HDM josm style, a custom map styling that customizes the display of OSM data in JOSM as users draw buildings, waterways, paths, and other points of interests to upload into OSM. Later, I also helped ybon (Yohan Boniface) with the HOT web map rendering described here. Still a work in progress, I’ve been stoked to work on this with Yohan and it’s coming along great. See this umap instance for an updated demo and an overview of its features. Check it out on github if you’re interested to contribute.

Fellow coordinators and I would also occasionally browse the changesets of our mappers to make sure they were mapping correctly. We had a couple RSS feeds set up for the area through whodidit to ensure mappers were actually uploading changesets and how much they were doing. The changeset history analyzer(currently offline) was also helpful as well to examine changesets to make sure our mappers’ changes were correct. OSMHV’s ability to display the specific tag changes that were made to an object as really useful as well.

Noon – Lunch time ! Outside the university grounds, were an assortment of makeshift roadside stands of rice and beans, fried chicken, egg sandwiches, and more.

3:45 – Our novice mappers leave for the day. Advanced mappers continue to map, inventory and begin to store equipment used during the day by the novice mappers and the teams in the field surveying.

5:00 – A wrap-up meeting of the day’s events with the advanced mappers, how field surveying went, updates on future meetings, mapping parties, and other events.

6:00 – Head back to the house for a combination of: surfing the internet, an informal meeting over Prestige, Haiti’s national beer with coordinators, reading, or Hanging out with the housemates. Many mappers had not used Ubuntu before and fell quickly in love with it. Several mappers who had their own personal laptops asked me and Yohan to walk them through installation and basic usage.

8:15 – Dusk, dinner at the roadside stalls is now available.

10-12:30 sleep awaits.

Some updates

Some assorted thoughts, happenings of the past couple weeks/months:

(Originally written on April 26, 2013 – forgot why this never posted..)

…..I’m stoked to announce that I’ll be joining HOT (Humanitarian OpenStreetMap Team) in Cap Haiten, from May-June. I’ll be with some immensely talented and great folks. We’ll be doing great work down there and working with local Haitian mappers. …..Alas, I’ll miss FOSS4G-NA, SOTM-US, mais, c’est la vie.

Coming to the realization that there’s simply so much learn and with increasing specialization, I should focus my learning efforts more on web mapping instead of print mapping.

note to self, I’ll be updating the site. Finally get a domain name name and strongly considering to move the site to jekyll.

………………

Also, looking over the popular apps on the droid market and seeing most of the apps on the top lists on the market were games, made me reflect: what has the droid really enabled us to do ?

What made me think is that there aren’t many “killer apps” but rather, general hardware improvements like:

– being able to check your email, communicate online, 24/7 thanks to mobile data plans and increased presence of wifi in public spaces.

– Gps

– a more improved camera that allows higher resolution, image stabilization, etc.

The lack of killer apps is also an indication that software being less app based and more web-based with Software as services and social networks that are OS independent like Dropbox, twitter, facebook.

Now, granted there’s a few things that are close to ‘killer apps’ for me.

– finding local reviews for restaurants when you’re out of town… (yelp) and soundhound and shazam. Thinking of the capability of a software on your phone that could identify a song by just playing a 10 second clip of it was a pipe dream just 10 years ago…

……………………

Mapping Cleveland’s Proposed Ward Boundaries of 2014

Monday March 25, 2013

Cleveland City Council President Martin Sweeney released the proposed ward boundaries for 2014. This is just one day before he presents them to be voted on in City Council.

City of cleveland issues this map. A JPEG. Not even georeferenced.
– it has no street names, all features (including rivers and railroads) are all styled the same. Nothing more.

This has sadly been characteristic of the City of Cleveland’s approach to open data, particularly spatial data…

Cleveland’s approach to open data, particularly in this instance, isn’t acceptable. Nor does it help foster a culture where civic hacking flourishes.

Great maps and other visualizations including this great slippy map of new Districts of NYC by WNYC (led by jkeefe) that inspired me to do this, shouldn’t be exclusive to the tech cultures that we usually hear (NYC, SF, CHI, Austin, SEA, PDX, on and on) or wherever Code for America stops in for the year.

Later that afternoon, Current Ward 14 Councilman Brian Cummins, had received PDF maps of most of the proposed ward and posted them on his blog.
A step above from what I had before. A Shapefile would be too much to ask.

(At least Kudos to him and my current councilman, Joe cimperman, for having twitter accounts and responding to their constituents on there. )

So I began by opening up a blank layer in JOSM, loaded in the Cleveland boundary from OpenStreetMap (less things to draw that way) and began simply tracing out the boundaries over Openstreetmap tiles. I was switching windows every couple minutes, looking at the JPEG boundary, then drawing the same lines in JOSM, repeat.

Had to be a better way, was going to take a couple hours (and it did).

(Side Question: What You use to draw geometries that you’ll later process in your maps/visualizations/analysis ? )

Behold: The georeferencing tool in qgis, which would let you load an image as a layer. This, I thought would be a shortcut. I could create the polygons of the wards by tracing right over the boundaries in the image, without hauving to switch windows.

The biggest problem was that I didn’t know the projection of the JPEG.
Unfortunately, these tutorials assume that your image is georeferenced.

To georeference in qgis, you should know what the projection of your original image is in before you start. If you don’t know, you’ll have to do some guessing and trial and error. I made a few guesses of the most popular projections (4326, 3857) and then tried several ohio ones. An hour or 2 later, none of the projections worked out.

So, I scrapped that idea, I began to draw the ways again in josm.
From there, I did my usual workflow which with I’m most comfortable into tilemill;

use osm2pgsql to convert my .osm file of boundaries (which were in the form of relations, specifically multipolygons) to load into a postgis enabled database.

(I’ve been meaning to become more comfortable with geoJSON and I would have tried to save my file in josm as json but I read there’s a bug in the json export of josm that doesn’t export relations correcty, I didn’t bother to verify this yet)

Next, I used Mapbox’s (which consists of data from OpenStreetmap) technique to create a custom map that I can use as my reference base layer.

Style my layer of proposed ward boundaries in Tilemill….

Then in mapbox.js, I simply put the two layers together. voila, as shown in my map at:

http://maps.jhfeichtnerfund.com/wards/index.html

Still more to do with this:

– finish up the documentation

– Tweak the colors
– Add in the census tracts so when a user hovers over an area, they can see the population of a particular place.
– add the existing boundaries too would be nice (as a separate layer for the online map)
– convert the 2014 ward boundaries (currently as a .osm) to a shapefile so others can use it.
Right now, it is available as an .osm in my github repo…

Follow this along in its github repo. https://github.com/skorasaurus/cleboundaries/

Life over the past 2 months

One of the big takeaways that I had from attending NACIS 2012 in October was to focus my efforts more on specific projects to more clearly demonstrate my mapping skills. So, I’ve taken
taking 2
Since December, I’ve spent most of my time on one of them, Cleveland Photography Society’s Scavenger Hunt Map

I realized that I wanted to take my maps to the next step, to offer interactivity, multi-zoom levels, I needed to learn how to code javascript (the language that mapping libraries like leaflet and mapbox.js are written).

It had taken me longer than I had planned to learn enough to reach my objectives for the Cleveland Photography Society’s Scavenger Hunt Map – http://maps.jhfeichtnerfund.com/
offering interaction (users seeing the picture when their mouse cursor is over the marking, a nice zooming action when someone clicks on the list of markers).

That said, I spent parts of December, January, and February, crashing head first into Javascript.

Initial, very brief thoughts on JS:
That there’s no standard for writing API documentation for javascript blew my mind.
As someone who’s learning, this can be frustrating at times.
However, I can understand (and don’t agree) the developer’s prospective: code becomes obsolete relatively quickly (within years), decreasing the incentive to write good documentation. Good documentation also means more than just writing enough notes for yourself so you could understand it months later. I am guilty of this myself sometimes for my projects.

– Best books so far to learn: Douglas Crockford’s “javascript, the good parts” and Marijn Haverbeke – http://eloquentjavascript.net

Also, mozilla’s js reference. https://developer.mozilla.org/en-US/docs/JavaScript/Reference

Most other online resources have been meh.

January, Cleveland has its first Open Geo meeting. Steve Mather and I organized it and it was a blast. I wrote a run down of it on my OpenStreetMap blog. http://www.openstreetmap.org/user/skorasaurus/diary/18494

In a nutshell, Cleveland was missing a place, really, a culture or ecosystem where people could informally talk about OpenStreetMap, open-source geospatial software, and other GIS-related projects [cool maps, data visualizations, analysis, etc] that they are working on. As the culture would develop, people would develop friendships, increase the size of their network, hare tips on using software, discuss geospatial news, share pointers on code, give career advice or share job leads, maybe even off or start ventures or even informal projects together. etc, all things that were missing or didn’t exist as much as they already did.

This culture isn’t going to develop overnight. But it’s starting. I’m excited to what will come out of it.

(Note to self, I do this more often, more and more things are coming into my head of things/projects that have been going on. )

How I tried to overlay a mask over multiple layers except for a specific region in Tilemill (and left with a buffalo tint)(and I liked it)

One thing about designing maps, you want to draw people to what they see (yes, ultimately the viewer will have their own subjective interpretation, but I digress…).
So, when designing a map to highlight the locations of 125 items that were to be photographed in the 2012 CPS Cleveland Photo Scavenger hunt, I wanted to focus on the contest area while giving viewers (likely participants who may have forgotten the exact boundaries or may not have done the scavenger hunt but would be at least familiar with downtown Cleveland) a little context of the surroundings.

How to accomplish this ? Well, I’m guessing it can be accomplished through a couple different ways: one, by, fading the surrounding features (this known as the buffalo tint) as shown in this demo by Bill Morris, wboykinm (he does inspiring works using Tilemill, pushes it to its capabilities, and blogs about it who does this buffalo tint over a separate base map, or by laying a gray mask over the surrounding area outside the border, on the same map.

Either of these techniques – Decreasing the opacity of the outside area or giving it a gray mask to make it a bit harder to read, drawing the viewer to the easier part to read and having the non-grayed part pop-out.

So, I started experimented in my project (based off originally osm-bright written by mapbox)

with map {
background-color: #999;
}

which would provide the gray mask, and one of the polygon comp-op function that allows you to do different effects on features in tilemill (using the gray mask)

#border {
opacity: 0.5;
polygon-comp-op: hard-light;
line-width: 4;
line-opacity: .65;
}

Unfortunately, all of the polygon-comp-op options that I tried including dst-in which had no effect or colored inside of the border. I uad only been able to lay the mask over the rest of the features inside of my polygon, (labels, roads, water, land), but not outside – what I’m intending to do.

So, hours later, I stepped away and thought how else to tackle this,
I came back, noticed, silly me, that

map {
background-color @water;
}

was called again in base.mss to provide Lake Erie with its blue sheen. I figured that might have something to do with it but that was a red harring. I eliminated that line and it left me with a gray lake.

Meanwhile, I hadn’t figured out yet or found anyone else who had done anything like this – overlay a mask over multiple layers except for a specific region in Tilemill.

(written on Nov. 28, 2012)
Flash forward 24 hours. This is why I love Tilemill. Yes, it’s free, open-source, supports linux (as well as win and osx). What you see is what you get – allowing you to code on one side while showing what your map looks like on the other. I’ve been a fan for a while, and I’m finally starting to make progress learning its intracies and operations 15 months later as its capabilities increase. It’s getting kudos by cartographers (Dane Springmeyer, lead developer of Tilemill, had the most attended presentation, by far at this year’s NACIS, the biggest annual mapping conference in North America).

I was a bit frustrated, and after a day of trying to understand the comp-op and wondering why all of the comp-op operations that I was trying had no visible effect or achieved the opposite of what I was intending to do, coloring inside the polygon, as shown above.

Only a few hours after I posted my query in TM support, Dane clarified some new tools that became available in mapnik 2.1 (just released 2 months ago) and how to go about doing it in Tilemill.

As of now, my code ended up as:
#border {
::outline {
line-color: #999;
line-width: 4;
line-opacity: .47;
line-join: round;
line-comp-op:multiply;
}
line-opacity: .95;
polygon-opacity:1;
opacity:.83;
image-filters:agg-stack-blur(10,10);
comp-op:dst-atop;
}

(for future reference, note: In this code, as opacity gets closer to zero, you are able to see more and more of the area outside of the border.

Resulting in:

As of now, I didn’t use the gray mask that I first intended to do (nor have I figured it out yet) but I’m really liking the results and I’m encouraged by my progress, to be able to do something that I hadn’t before.

Work on this isn’t done (I’d like to customize the colors a little more, maybe add interactivity) and you can follow the progress at its github repo and view the map.

Should I be a super user in postgis ? And other beginner’s questions about roles and users in postgis

I have a confession to make. Some reasons that I don’t post on here because:
a] I don’t want to appear too ignorant to others. Typing this out makes me realize the above thought is pretty sophomoric. We all have to start somewhere when we learn things including postgis, programming, cartography, and other things in the geospatial world.
b] Like others, I don’t always want to go back to my notes to write concise documentation. I just write enough to make sense for myself later on. Other tech writers do the same thing when they write documentation… leading to point C [SIDEBAR: I keep a textfile of every each problem, install issue, question that I have, named log-nameofprogram].
c] Most documentation for postgis and I’d extend this to linux, is written so that the reader is assumed to know a lot. This is a pet peeve of mine, and by not doing this myself, I’m a hypocrite. Below is an example…

Here is my journey along the way of learning all of this…. With that said…

What’s the difference between a “super user” in postgres and another user ? Should I use the ‘postgres’ user in my day to day postgis work ? Should my created user be a super user ?

All of my mapping work is locally done on this computer. I’m the only user. Occasionally, I’ll make dumps of my db’s and then store them in other places.

Until now, I had been just using postgres (the default user name, after you install postgres) as my user name. I knew that you could create a user name, but wasn’t sure whether I should or not in my case. What was the difference anyways ?

As a result, whenever I converting data into postgis databases, I would have to copy these data files (usually from OSM) into /tmp because postgres could access files from my /home . I was finding it to be a bit inefficient, and I was prompted to determine whether or not I couldn’t access my python virtual environment (where imposm is installed) while logged in as postgres..

So, as I was looking to create a new user, I was wondering whether or no to be a super user’

The Postgresql documentation was a bit helpful.
Stating:
“Only roles that have the LOGIN attribute can be used as the initial role name for a database connection. A role with the LOGIN attribute can be considered the same as a “database user”. To create a role with login privilege” use either:

CREATE ROLE name LOGIN;
CREATE USER name;

What does LOGIN priviledge mean exactly ? Oh, well. A couple paragraphs down, they mention that I can issue CREATE ROLE name CREATEDB.

postgresql up and running (the book) explained it differently, telling that you can create the users in pgadmin or by the command line and highly recommend to create a new user after ASAP after installation, by doing:

CREATE ROLE leo LOGIN PASSWORD 'lion!king'
CREATEDB VALID UNTIL 'infinity';

It raises a good point, do I want a password with my postgres user account ?
“If you wanted to create a user with super rights, meaning they can cause major
destruction to your database cluster and can create what we call untrusted language functions”
Not sure what untrusted language functions are, but I’ll trust them and create the user. ‘

Well, after running, logged in as postgres (you can log into postgres through different ways, including sudo -u postgres -i) launching psql in the terminal, I typed in:
CREATE USER skors
(skors – my user name, also the user name for my desktop as well. I forgot the ; but it’s no big deal because I was able to create a database simply by doing: createdb nameofdb)

So, I go to add postgis capabilities now to my newly created database using my user name by doing

psql -d cleve -c "CREATE EXTENSION postgis;"
ERROR: permission denied to create extension "postgis"

argh ! Why shouldn’t I be a super user if I have to be a super user to create a new database ?

Which leads me full circle back to my questions that I asked in the beginning still unanswered:

What’s the difference between a “super user” in postgres and another user ? Should I use the ‘postgres’ user in my day to day postgis work ? Should my created user be a super user ? Do I want a password with my postgres user account ?

Cleaning up .GPX files for OpenStreetMap and Visualizations.

While going through the rest of my GPS traces from the HOT exploratory mission in Senegal [some write-ups on the HOT blog], I had found one GPS trace that has 2 problems that I’ve occassionally experienced while collecting gps traces for OpenStreetMap.

– The GPS signal is temporarily lost and the distance between 2 points of your trace is abnormally lengthy,
and cuts across roads and features.

An example: Did I time-travel across that area ? Nope. Did I time-travel across that area ? Nope.

– And what I call the ‘scribble effect’ (is there another name for it?), where I accidentally forget to turn off the gps after I arrive at my destination and end up with multiple points near each other, looking like a child scribbled in a coloring book.
An example:

If you’re planning to make any visualizations with your traces, these two symptoms allow viewers to misinterpret where you’ve been and make your visualizations inaccurate.

The scribble effect also negatively affects OpenStreetMap because GPS traces that are uploaded in the future in the same area as your scribbled GPS trace, other users will be able to not be discern the newer gps trace from your scribbled gps trace. There’s also still a few places on earth (including some regions of Senegal) that don’t have any satellite imagery to (legally) use for drawing ways for OSM.

So, after you complete a trace, how do you eliminate these symptoms described above?

I’ve tried a combination of different filters with gpsbabel – (explained more here)

but have yet to find a single command that would solve both issues.

gpsbabel -t -i gpx -f gpx_louga_03062012-withmay.gpx -x track,pack,sdistance=0.6k -o gpx -F test7.gpx
– this had fixed the temporary signal loss … but it didn’t fix the scribble effect.

gpsbabel -t -i gpx -f gpx_louga_03062012-withway.gpx -x discard,fixnone,fixunknown -o gpx -F test.gpx
(resulted in a blank GPX File.

gpsbabel -t -i gpx -f gpx_louga_03062012-withway.gpx -x discard,fixnone -o gpx -F test.gpx
(no effect)

gpsbabel -t -i gpx -f gpx_louga_03062012-withway.gpx -x position,distance=3m -o gpx -F test3.gpx
(this removed the long points between the 2 segments, but didn’t solve the scribble effect)

gpsbabel -t -i gpx -f gpx_louga_03062012-withway.gpx -x discard,hdop=5,hdop -o gpx -F test6.gpx
(no effect)

gpsbabel -t -i gpx -f gpx_louga_03062012-withway.gpx -x position,distance=10m -o gpx -F test8.gpx
– removed 1100 of the trace’s 2400 points and the , but still left me with the scribble effect.

I’ll continue to explore cleaning up the GPS traces with GPSbabel filters and hope to find a way but if you know of a specific filter in gpsbabel or any other way to do this, besides manually deleting the offending points in gpsprune, I’d appreciate it.

Update: Dec. 1, 2012. I also shared this in an OpenStreetMap Diary Entry in Sept. Other OSM users have also experienced this problem and hadn’t found a solution besides what I’ve described above. So, I’ve found that the test3 example above and manually removing the points in gpsprune (from the scribble effect) is the easiest way to clean up your GPS points.

Best practices for styling your tilemill stylesheet

(last updated July 2013)

  • Should I create separate layers for labels and then for the features (roadways, buildings, etc) themselves ?

Yes. If you’re intending to display text of any feature (like the name of a building or road), create a separate layer for them. You can name it as ‘labels’ or whatever you’d like. Labels are not yet automatically set to render on top of every other feature (<a href=”https://github.com/mapnik/mapnik/issues/87&gt;) layer so the text will not display as you intend in some instances (Dane Springmayer gave me a much more detailed explanation at State of the Map-US 2012).

Should each feature (roadways) have a separate layer ?
Do you have different layers for each zoom level ?

It’s common practice to have separate layers for highways based on different zoom levels.

Wnat data sources should I use ? Is there an advantage to use SHPs over PostGIS Databases ? GeoJSON instead of sqlite ?

 

I haven’t found any Tilemill stylesheets that extensively use layers from postgis besides osm-bright and am curious to see what others do.

  • Other Tips:

Remember to ask yourself at each particular zoom level, what do I specifically want to show at this zoom level ?
– (J. Lord – State of the Map, US 2012)

 

Debugging, or why is my code or Tilemill, not working ?!

– Normally, Tilemill will point out a specific error in your Carto if it’s not formatted correctly.

 

However,

 

If you want to see some carto in action, of howto write, manage your stylesheets, here’s a couple that I admire,

Osm-bright – Made by Mapbox.
Uses Postgis layers as their data sources;

openstreetmap presentation

Short notice, but I’ll be giving a presentation on using Openstreetmap and my work on Cleveland in OSM Tonight at BW’s ACM’s Chapter meeting if any readers are interested.

7:00 PM, Room 147, Math and Computer Science Building, Baldwin-Wallace College (This Room is in the Mathematics wing).