3

I'm planning to create an online map with openlayers (2 or 3) or leaflet. I have to show some points/markers (~30.000), polygons (~500) and lines in an area of ~10x10 kilometers in several layers. This data comes in local x and y coordinates. The background will be made of raster tiles, perhaps OSM.

Now I'm wondering, whats the best strategy to do this.

  • Is it possible to make the local coordinate system the default for the whole map in one of those map libraries?

  • If not, should the data be converted into the coordinate system of the map (WGS 84) in the database or a cache or doesn't that matter?

2 Answers 2

4

Is it possible to make the local coordinate system the default for the whole map in one of those map libraries?

You surely can. But then the base layer must be in this CRS too, meaning that you wont be able to use OSM from a public source.

If not, should the data be converted into the coordinate system of the map (WGS 84) in the database or a cache or doesn't that matter?

Yes, it matters. If you wish to use OSM then you must use EPSG:3857, and any other layer you intend to overlay must also be available in such CRS. How to make that CRS conversion depends on how you intend to access the data:

  1. Through OGC WMS - this way you can set up a service with the original dataset and instruct the server (e.g. MapServer, Geoserver) to provide it in an alternative CRSs.

  2. Direct from the dataset files - this way it is better to re-project all datasets a priori into EPSG:3857.

I would advise you to go with option 1 and use OSM as a base map. This will possibly achieve the better end user experience.

3
  • Thank you! Would it be possible to add custom properties to features, that are passed as WMS vector tiles to the client and add javascript event handlers to these features (show popup on mouseover with detailed information to this building, ...)?
    – stofl
    Commented Nov 15, 2013 at 16:53
  • See my answer just posted, you would have to use WFS to get the feature information, but yes it can be done. If you are using a WMS, then you would need to have the additional data in a database. Commented Nov 15, 2013 at 17:14
  • Would the data be added to the SVG in WMS?
    – stofl
    Commented Nov 15, 2013 at 17:54
0

Depending on how you want the data supplied to Open Layers, but if the points are relatively static, I would suggest converting them to to WGS84 then serving them as GEOJson to Openlayers on a Vector Layer. OpenLayers will re-project to your base map EPSG:3857 if you use OSM, or you could re-project them initially to EPSG:3857 if you wanted.

If you use Geoserver, then a Postgres Database would be the way to go. Re-project when storing in the database and then have the data served by WFS or WMS. Geoserver will handle the re-projections between WGS84 and EPSG:3857 automatically.

With the number of points you mention, you may want to consider the GeoServer approach and WFS to reduce OpenLayers resource usage. I think it may choke if you serve it that many features as one file.

2
  • Thank you. What is the advantage of "converting them to WGS84" and let OpenLayers "rp-project to your base map EPSG:3857" over converting them directly into EPSG:3857? To yout WFS suggestion I started another question: gis.stackexchange.com/questions/77656/…
    – stofl
    Commented Nov 15, 2013 at 17:53
  • None, other than WGS84 is real world, ie: matches what a GPS produces so just a little easier to work with. Openlayers will project back the other way just as well. Commented Nov 15, 2013 at 23:29

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.