1

I have implemented a simple OpenLayers map to plot stores on the map. I've done this using a WMS.

Fiddle: https://jsfiddle.net/7n42uaux/3/

Now I want to use OpenStreetMap(OSM) maps.

new OpenLayers.Layer.OSM();

When I do change it, the map gets drawn but the clusters don't get plotted properly. They are all shown as a summation and in the wrong location in the map.

2
  • the fiddle does not appear to work...
    – fidelfisch
    Commented Sep 22, 2015 at 17:12
  • 1
    that's just because of the missing CSS-rule for the map container (add something like #map { height:500px;} )
    – Thomas B
    Commented Sep 24, 2015 at 8:24

1 Answer 1

1

You can define an internal and external projection for your GeoJSON-Format:

var geojson_format = new OpenLayers.Format.GeoJSON({
  'internalProjection': new OpenLayers.Projection("EPSG:3857"),
  'externalProjection': new OpenLayers.Projection("EPSG:4326")
});

just have a look at my version of your example: http://jsfiddle.net/expedio/gmy0rpam/

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.