[OpenLayers-Users] [OSM-dev] Some OpenLayers-based OSM hacking

Christopher Schmidt crschmidt at metacarta.com
Mon Oct 15 09:08:46 EDT 2007


Originally this was posted as a response to dev at openstreetmap.org, but
it's really more about OpenLayers than OSM. I'm sending it there --
followups should go to users at openlayers.org. 

On Mon, Oct 15, 2007 at 08:39:22AM +0100, Patrick Weber wrote:
> Christopher Schmidt wrote:
> >Hello Dev --
> >
> >I've been doing some OSM hacking based on OpenLayers trying to figure
> >out what we need to put into OpenLayers for 2.6 to make OpenLayers a
> >more reasonable tool for working with OSM data.
> >
> >OSM data drawn in SVG over mapnik tiles. (These are mapnik only because 
> >reprojection support isn't in OpenLayers yet: I'm actively workin on
> >that, and it will be in 2.6 in some form, and may be in OpenLayers in
> >the next couple weeks.) 
> >
> > * Adding a .osm file is as simple as: 
> >    gml = new OpenLayers.Layer.GML("OSM", "xml/cambridgeport.osm",
> >                                   {format: OpenLayers.Format.OSM}); 
> >  
> Great idea to do SVG rendering!!! I have been waiting for something like 
> this. Now, what I would be interested in is using your gml adding 
> functionality to add a thematic layer over the basedata. 

Note that there is not actually any GML involved here: "Layer.GML" is
really just "Layer.RemoteVectorDataFile", but poorly named.

> Say I have a layer with all of the UK's local authorities as polygons,
> and associated statistics. 

What format? KML, GML, OSM? The first two are better interchange formats
for non-topological data, and fully supported by OpenLayers. 

> I could build a OSM file that for example shows poverty levels, and
> display it on the map as a SVG overlay over the Mapnik png files. 

You could also just use a GML or KML file, though at the moment, there
are limits to what you can do with the 'official' tiles because of lack
of reprojection support (as I mentioned in my email). Unless the data is
already in OSM, there's not much reason to convert it just for display. 
See
http://www.cartoweb.org/v4/demos/v0.1/demos/world_factbk/geostat.html
for an example of display of population levels, for example, which is
pulled from a GeoJSON dataset. (Under Chloropeth.) 

> What kind of performance could I expect ? Is there a limit on how many
> svg objects one can display in the browser? 

Yes. Depends on the browser, mostly, but it's pretty safe to assume that
more than 100-200 DOM elements in a draggable map browser page is likely
to make things start slowing down. (Parsing also becomes a factor at
some point -- loading and parsing a 4MB .osm file is enough to make some
browsers unhappy.)

> Depending on the complexity of the polygon? 

In part, but less so. This affects the parsing/display time, but not the
interaction, for the most part.  

I've CCed the OpenLayers-Users list with this email: I'd suggest that
anything which is more generally related to 'displaying Geo data in an
OpenLayers Map' be taken there, as there is a large community of highly
skilled people on that list who have done things exactly like this. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list