[OpenLayers-Users] GeoJSON based vector-layer with openstreetmaps

Christian Benke benkokakao at gmail.com
Tue Jul 31 14:13:48 PDT 2012


Hello!

I'm having difficulties to understand some basics of openlayers and
projection. I'm trying to put tracks in geojson-format on a map. This
works just fine with a WMS-Layer, but i seem to miss a crucial
connection when trying to display it on an OSM-layer.

I've tried to decipher the example at
http://openlayers.org/dev/examples/fusiontables.html(Which uses
GeoJSON on OSM) to adapt it to my needs, but as it is a lot more
abstract than the very basic example-script i'm starting off, i get
stuck even earlier when trying to change the geodata-source to my
flatfile.

Here is my basic example with WMS:
http://poab.org/openlayers/geojson_wms.html

And here's the same, but the map-layer is of OSM:
http://poab.org/openlayers/geojson_osm.html

On both maps i try to display GeoJSON-data from
http://poab.org/openlayers/gpx2json.js, with WMS this works fine, with
OSM it doesn't.

I guess the problem lies within the projection/transformation of the
GeoJSON-data, but i'm having a hard time figuring out how this is
supposed to work and why the tracks are not displayed at all(Or at
least how i can get it to tell me errors while parsing, if there are
any).
Obviously the WMS-layer is displayed very differently than the
OSM-layer, so i assume that the GeoJSON-data also has to be adapted to
be OSM-projection so it can be displayed on top of it?

A related question: Why does the OSM-Layer need to be transformed to a
different projection for centering it, not just setCenter with lon,
lat and zoom like WMS?

These are probably very basic questions for an experienced user - i'm
currently a bit overwhelmed by the amount of information to digest
while trying to get a understanding of GIS - i ask for patience, i'll
probably post a few more ignorant questions to this list in the next
few weeks.

Best regards,
Christian


More information about the Users mailing list