Archive for the 'Locality and Space' Category


Posted in Locality and Space on January 5th, 2009 at 00:47:40

For ages, people have been asking me to help them with shapefile to OSM conversion, because I wrote one of the scripts that got used a lot for different conversion projects. Since I get a fair amount of email on this, I figured it was worth blogging that I’ve actually put together a newer script from scratch that does something similar, though for Polygons instead of lines.

One of the benefits of this script is that it was written ahead of time with the intention of sharing it — which was never meant for the other script that I wrote. This means that it is slightly more readable; at least, the unreadable parts are better separated. (I will admit that there are several aspects of it that are terribly un-Pythonic.)

You can find the code in OSM’s shp2osm directory.

Some aspects of this code:

  • It is designed to help you create .osm files you can read/merge in JOSM, so it has the ability to do vertical striping across a dataset in order to create geographically ordered smaller datasets.
  • It has an option to limit the number of objects per .osm file; this defaults to 50,000, which in some cases was about JOSM’s limit. (In others, it seemed lower; it’s adjustable via a command line switch.)
  • Uses optparse, which means –help does help you (once you read the initial docstring and get yourself started.)
  • Supports both direct tag mappings (shapefile-attr -> OSM-attr) as well as custom functions to add more tags based on multiple attributes of a feature. It was built for the MassGis OpenSpace Layer upload (which is now in progress), so it needed more advanced tagging possibilities.
  • Supports saving the original shapefile data ‘automatically’, to create the possibility of recreating the original shapefile attribtes. These attributes are namespaced so as to minimize collisions.

The script was also used to convert the MassGIS buildings layer, which means that there are now building outlines for metro Boston slowly appearing on the map.

If you have polygon data, this tool may be helpful to you. If you don’t have polygon data, this tool also may be helpful to you, as a better demonstration of how to map shapefiles into OSM data without writing all the code yourself.

I’m not likely to be doing a lot of support for this, but I wanted to let people know, because I personally think the code is much much more readable than the last shapefile conversion tool I wrote. (Also, it’s not every day I get to collaborate on OSM with Tim Berners-Lee.)

OpenAerialMap Project Update

Posted in Locality and Space, OpenAerialMap on December 18th, 2008 at 20:24:06

For the past 6 months, the OpenAerialMap project has been in a state of … well, stagnation would be a nice way to put it. I’ve just sent an email to the mailing list Outlining the status as I see it, and I would love to see feedback and opinions on the list.

The biggest problem with OAM is that it never developed a community around it. My hope is that with an increase in interest in the past $shortWhile, there is sufficient interest to build a community this time around, and with that, enable the project to succeed in a way that it couldn’t 6 months or a year ago.

Using Jython + GeoTools

Posted in Jython, Locality and Space on December 15th, 2008 at 12:34:32

So, after a weekend of working with Java and GeoTools, suddenly things got a lot simpler to work with in Jython. This is a case of trying to do the completely wrong thing because I don’t know anything about the project, packaging… or language.

Thankfully, I’m now much better off, and have put together a little HTTP server that runs and gives me back WKT for any EPSG code, using Jython + GeoTools.

The code is very simple: the geotools-epsg-server just takes in a code, and spits out WKT. It uses the GeoTools CRS package, and a BaseHTTPServer.

It’s not much, but it’s enough to get me in the right direction. Maybe I’ll even stop whining about Java so much, since I can use it more like Python…

Nah, that wouldn’t be any fun.

Jython + TileCache/FeatureServer: It Just Works

Posted in default, ESRI, FeatreServer, FeatureServer,, TileCache on December 14th, 2008 at 10:37:04

Earlier today, I tried Jython for the first time, because I’m doing some work that may involve interactions with Java libraries in the near future. Jython, which I’ve always avoided in the past due to an irrational fear of Java, is “an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform.” (I love projects that have great one-liners that I can copy paste.)

My goal for Jython was to do some work with the GeoTools EPSG registry code related to Sadly, I didn’t get that working, but in the process, I learned that Jython now has a beta version which is up to Python 2.5 — much newer than the 2.2 that had previously been available.

With that in hand, I decided to see if I could get some of my other Python projects running under Jython. I’m the maintainer for both TileCache and FeatureServer — two pure Python projects. Theoretically, these projects should both work trivially under Jython, but I’ve always had my doubts/fears about this being the case. However, it turns out that my fears here are entirely unfounded.

I downloaded the FeatureServer ‘full’ release from this includes the supporting libraries needed to get a basic FeatureServer up and running. I then tried to run the FeatureSever local HTTP server… and it worked out of the box. I was able to Load the layer, save data to it, query it, etc. with no problems whatsoever. Java has support for the DBM driver that FeatureServer uses by default, so out of the box, I was able to use FeatureServer with Jython without problems.

Next came TileCache. TileCache was originally built to support Python all the way back to 2.2, so I wasn’t expecting many problems. Getting it running turned out to be almost as easy: the only code modification that was needed was a minor change to the disk cache, because Jython doesn’t seem to support the ‘umask’ method. Once I changed that (now checked into SVN), Jython worked just as well with TileCache as it did with FeatureServer.

Clearly, there are some things which are less trivial. The reason that these libraries were so easy to use is because they were designed to be low-dependancy: TileCache and FeatureServer default paths are both entirely free of compiled code. Using something like, for example, GDAL Layers in TileCache, would be much more difficult (if it’s even possible).

However, this presents some interesting capabilities I had not previously thought of.

For FeatureServer, this means that it may be possible to write a DataSource which accesses SDE using the ArcSDE Java API, ESRI’s supported method for accessing their SDE databases. One of the purported “holy grails” of the GIS world is RESTful access to SDE databases via lightweight servers — Jython may provide a path to that, if someone is interested in it. (It may be that this has become a moot point with the release of the ESRI 9.3 REST API — I’m not really sure.) This may be a waste of time, but the fact that it *can* be done is interesting to me. Edit: Howard points out that ArcSDE read/write support exists in OGR 1.6, so this is a moot point; you can simply use OGR to do this without involving Jython/Java.

I think this might also speak to a possibility of having better answers available for people who want to use things like FeatureServer from Java platforms (though I don’t know enough about jython to be sure): the typical answer of “use GeoServer” is great, but to be able to provide something a bit more friendly would be interesting. Thankfully, the Java world is largely catching up to the advances made in TileCache/FeatureServer, so this is also less urgent than it has been in the past.

In the end, this was likely simply an interesting experiment. However, it’s nice to know that the capabilities to do things like this within Jython are improving, and that Jython continues to advance their Python. The 2.2 release being the ‘current’ one still is disappointing, but seeing a 2.5 beta available is an exciting development.

As I said, the current version of FeatureServer works out of the box with Jython, and I’ll be doing a TileCache release shortly that will work with Jython out of the box as well. It’s neat to see more possibilities for using these libraries I’ve spent so much time on.

Open Source Project Documentation: OpenLayers

Posted in Locality and Space, OpenLayers, Social on December 11th, 2008 at 16:38:34

Earlier today, I read a post on the OpenGeo GeoSpiel blog calling for OpenLayers to get on the “Usable Documentation Bandwagon”.

Now, I’ll be honest: I followed the links that he offered, and found something that is not, to me, much more convincing than the OpenLayers documentation as it stands today. If I look at ESRI’s JSAPI, I see a couple things wrong right off the bat — like the fact that I can’t actually link to where I want to. In any case, if you click Geometry -> Point, you see a document which, to me, is a lot less interesting than the similar page provided by OpenLayers.

Perhaps there is some subset of documentation put together by ESRI in their JSAPI that makes sense, but for an API reference, it seems to me that OpenLayers does reasonably well on the portions of our API that someone has invested time to work on.

This doesn’t mean we’re “done” by any stretch of the imagination: One of the things that I’ve wanted to do for ages is actually sit down and do a thorough review of the OpenLayers API documentation and improve a lot of it, targeting cross-linking with other documentation and examples especially. These types of tasks, however, are the types of tasks that require a lot of time, and don’t have a lot of immediate benefit. Since all work on OpenLayers for the past several months has been my personal free time after work, there’s only so much I’m personally able to do. However, no one has *ever* made a request to the OpenLayers team to be able to do this work — including OpenGeo — that I’ve seen. It seems to me that whit is experienced and knowledgable about OpenLayers, since I’ve seen him using it for development, but I’ve never seen him ask to participate in improving the OpenLayers API documentation on the mailing lists, nor have I seen a request of this nature from any other organization.

To me, this means that it’s likely that our API documentation does, to some extent, meet the needs of the organizations using OpenLayers. It’s not perfect — nothing is — but no one thinks it’s a major stumbling block that’s worth fixing, at least not enough to spend money on it.

This is exactly the type of reason that OpenLayers is now accepting Sponsorship from organizations looking to support the project. This type of improvement is exactly the kind that project sponsorship can help support.

OpenLayers is aware of how important documentation is to the success of the project. We have invested dozens of hours between a dozen different contributors to create and maintain a set of relatively complete API documentation. According to Ohloh, of the 55,000 lines in OpenLayers Javascript, over 30% are comments: over 25,000 lines of what is mostly API documentation. No one is ignoring the problem — and if the current state is insufficient (as everything in the project is, *especially* to new users and beginners), then we’re very open to help from any and all interested parties.

API documentation isn’t the only thing a project needs, of course. Documentation comes in all forms — and OpenLayers is seriously lacking in a lot of documentation targeted towards beginners of all kinds. We’ve been working to change that, with a new documentation site available, and other efforts targeted documentation of OpenLayers in English and other languages. I would say these efforts are much less complete than the API documentation, and starting on them is far more important, in my opinion, than improving our API documentation is at this time.

OpenLayers is a large library. It’s used by many organizations. We’re open to contributions of all types — never have I seen OpenLayers turn away someone who wanted to help with documentation intentionally. We have regularly worked with contributors in helping them to improve the documentation, and to claim that we are ignoring the need for documentation seems to me to be representative of a lack of knowledge of the tools that the project uses for documentation, not specifically a lack in the goals of the project, which puts documentation of functionality — via API docs and minimal examples demonstrating functionality — as a requirement of almost all new code in the library.

FOSS4G2008 Tokyo — OpenLayers: Past, Present, Future

Posted in FOSS4G 2008 Tokyo, Locality and Space, OpenLyers on November 1st, 2008 at 23:18:53

I presented at FOSS4G 2008 in Tokyo today, thanks to Orkney,, and MetaCarta. Gave a talk on OpenLayers: Past, Present, and Future. Hard to gauge success of the talk: many people seemed somewhat bored, but my typical attempts at keeping interest are not so effective in a room where most people don’t speak the same language as I do.

Went over history of OpenLayers — a bit of the pre-“Mark IV” that most people think of as being “OpenLayers”, then into why MetaCarta initially started the project — plus present status/features/developments, then into future (2.x and 3.x), and gave some demos of functionality.

Got a couple good questions — so at least a couple people were interested, which is more than I can actually say about many presentations where people *do* speak the same language. 🙂 Questions are notoriously hard to get out of people at conferences.

Had shrimp tempura for lunch, which should help me keep my energy up for the workshop I have to give in a bit more than an hour. I’ll be presenting using a trimmed down version of Tim/Seb/OpenGeo’s OpenLayers workshop: to about 10 people, as I understand it. Should be interesting to see how far we can get in 1.5 hours.

Staying awake is going to be tough. The 13 (soon to be 14) hour time difference is quite significant in a way I hadn’t realized.

FOSS4G Post-mortem

Posted in FOSS4G 2008, Locality and Space on October 10th, 2008 at 05:36:36

One of the most common complaints I’ve heard about FOSS4G this year is the lack of information coming out of the conference. As far as I’m concerned, that’s down to one simple fact: being held in a developing country leaves much to be desired with regard to connecting to the rest of the world in any number of ways.

Whether it be the lack of SMS (too costly to use idly — messages ending up in the US at a service like Twitter end up being $0.25 apiece, even with a local SIM) leading to less Twitter activity, limited internet bandwidth making even getting to a website — much less updating one — far more difficult, lack of decent hotel internet, and paying an arm and a leg when it does exist… the end result is a situation where simply getting online to chat on IRC was far more than many people had an opportunity to do during the conference, and the more regular ‘datastream’ that comes flowing out of most conference attendees during a conference in a more well-connected part of the world was simply nonexistent.

A slightly less technical and more social aspect to this may be the fact that Cape Town bars stay open til 4am, and I know I wasn’t the only FOSS4G attendee they were kicking out at closing time every night.

Combine that with the distance of the trip, and right now, I bet a lot of people are still either here in Africa (as I am: Posting from a Cape Town hotel) or still recovering from their trip, and haven’t had the opportunity to do the detailed breakdowns that people had hoped for.

My take on the conference is that it was great for the people who attended. There was a huge crowd of people who had limited or no experience with Open Source software, or had just recently heard about it and were not really understanding what it meant, or how it worked, or why it mattered. I think that there were a number of people who were interested who were able to learn more — even people who work in communities which are not traditionally open to that kind of solution.

There were a number of presentations on many things that I don’t think we would have seen at a more software developer oriented conference. The uses of GIS — to track water pipeline breakages, to visualize the spread of malaria, to track the best places to plant grapes for growing better wine — are something that we saw much more of at this conference than at previous conferences. I think that this was directly tied to the fact that this conference was clearly a merging of two generally distant groups, and I think the end result was productive for both groups.

The attendance was, from what I heard, 50% ‘locals’, from around South Africa and the rest of Africa. There were many new faces who clearly would not have been able to attend a conference in the US or Europe, and for that alone, there was a benefit to the community as a whole to have the conference in Cape Town.

The organizers did a great job arranging the event: the venue, activities, and sessions were, on the whole, well set up. Also, the food that was provided was some of the best I’ve ever had — at a conference or anywhere else.

Overall, the conference was educational, helped to establish Open Source GIS software in a new location, helped to spread the worldwide knowledge and usage of Open Source software, and introduced the concepts that we in the OSGeo world would like to push onto others wherever appropriate. There was a huge cross breeding of information and cultures that wouldn’t have been possible in another setting, and — despite the distance, cost, and other possible pitfalls that could have befallen the conference — I think that placing the conference in Cape Town was a huge success. There have been a number of doubts voiced as to whether this was really the right decision — certainly, it made attending more difficult for a number of people who would have been at a North American or European event. These doubts and complaints are not to be ignored: It’s true that FOSS4G is meant to be a meeting of the tribes of OSGeo, and that aspect of it was more limited this year than in the past. However, the end result is that hundreds of people who would have had absolutely no chance of making it to an event in the Northern Hemisphere did so, and a number of them have been introduced to and hooked on Open Source software in a way no other event would have been able to.

Placing the conference in Cape Town had a specific goal of spreading Open Source software to someplace that it had not been as successful as possible in the past. With that in mind, this Cape Town conference succeeded in more ways than I can count, and that’s a big win for the conference and for OSGeo as a whole.

Finished FOSS4G Photo Uploads

Posted in Flickr, FOSS4G 2008 on October 10th, 2008 at 05:13:26

I finally finished uploading all the photos I took at/around the FOSS4G conference.

FOSS4G 2008 Set

Includes photos from:

  • Various nights hanging out at the bars/hotels during the conference
  • A trip up Table Mountain with OpenLayers/OpenGeo folks
  • GeoDjango Workshop
  • Sessions, exhibition hall, etc.
  • Pictures from the Gala Dinner at Moyo
  • Closing Session
  • OSGeo AGM
  • OpenLayers Workshop
  • GeoServer Workshop

Photos that are taken at the conference center/of conference proceedings are also tagged with foss4g2008:

foss4g2008 tagged

And most photos of people who I recognized are tagged with first name in the title, and with a username (as used on IRC or other unique identifier) attached as a tag:

Photos of Arnulf
Photos of Steven

Photos of the OSGeo AGM are also tagged as such:

OSGeo AGM Photos

I’ve made my tagging settings as open as possible, but I believe you still need to be a contact on flickr in order to add notes/tags to photos: simply add me as a contact, and I’ll add you back.

Any names I got wrong, please let me know, either via email or by simply commenting on the flickr photo.

Thanks to all for helping to create such a photogenic conference.

OL Sessions at FOSS4G

Posted in FOSS4G 2008 on October 1st, 2008 at 02:15:38

Just watched Bart’s presentation on his employer’s use of OL + ExtJS: to see a map customized so thoroughly that I can no longer recognize it as OL is kinda neat.

Now watching Tim Schaub explain Vector Styling; “So new many developers don’t even know how to use it.” I’ll state that I think this is equal parts ‘new’ and ‘lack of effort into documentation’ 🙂 Showing a *really* cool styling demo tool, which lets you put in code, run it, and executes the JS and creates a map. Totally need to get that into the website.

Showing the addUniqueStyleRules stuff; just keeps reminding me we really need graduated symbolizer convenience methods. Maybe I can convince him to do that at the code sprint this weekend.

We need to get these style rules in SVN somewhere; Tim’s clearly done a lot of work very recently on this, and getting this into the documentation and website sounds like a great thing to me.

FOSS4G Starts

Posted in Django, FOSS4G 2008 on September 29th, 2008 at 07:55:41

After climbing Table Mountain yesterday, I’m somewhat beat, but was able to make it up at 0730 to give a GeoDjango workshop with Josh. After spending the first hour running around attempting to get power for everyone and get DVDs copied, we got started.

Overall, the workshop went well. We had a variety of users — including two people who were relatively successful with running GeoDjango from their own (mac) laptops. I’ve learned a few things about using VMWare — for example, I was reminded that there is no real VMWare option for PPC Macs, and that installing VMWare on Mandriva is not as trivial as it maybe should be.

I was able to get two of my machines working with the VMWare DVD we had and distributed (link later once I talk to Josh and we fix some of the missing things), and gave them out to people. With our 25 people, we had about 15 laptops running, with others sharing.

Learned a few key points: For one, our documentation on the workshop was insufficiently explanatory of how to do things like “edit files”, “open a terminal”, etc. A number of people were facing significant problems towards the start because of that. (Also, not installing vim on the VMWare image was problematic for me, and Erik had the same problem with emacs.) Due to the somewhat staggered start, we got a little bit lost in the weeds pretty quickly, and didn’t get a chance to really explain what GeoDjango was about to start, which I think was a lack in the workshop.

Overall, we got through setting up the VMWare image (though not installation from scratch), starting a project, creating a model, setting up the admin (with this being one of the more difficult parts, specifically because almost no one had internet access within the VM), generating KML, viewing the KML on an OpenLayers map, and using the GDAL tools (LayerMapping) to import polygon data from a shapefile and view/edit that. A couple people got ahead through creating a Ward view as well, which was nice.

There are a number of aspects of the workshop that need more polish, but overall, I think people who were interested got to see GeoDjango in admin, and see why it’s pretty cool. Hopefully we can clean up our workshop docs to make it smoother for the next person to walk through it, and get more people interested in GeoDjango and learning about Django in general through that.