I'm using GeoNetwork 3.0 where users can upload their own layers from the interface to my GeoServer. GeoNetwork 3.0 uses OpenLayers3. For my application, I need to determine the crs from this layer so I can transform it to EPSG:3857, if it's not already.

How do I get the projection from a layer in OL3? Or can I tell GeoServer to transform all uploaded layers to EPSG:3857 by default?

  • 1
    just request the layers in 3857 - OL will do this automatically. – Ian Turton Jul 28 '15 at 12:44
  • The layer is displayed correctly. But when I request featureinfos from a layer, the coordinates will still be in the uploaded crs and not 3857. Don't they? – Antivist Jul 28 '15 at 12:55
  • getfeatureinfo doesn't usually include coordinates – Ian Turton Jul 28 '15 at 13:02
  • You can request the features from a MapServer with getGetFeatureInfoUrl(). Using http.get(url) will respond with a FeatureCollectionObjection containing coordinates among others attributes. Yes - it's not exactly getfeatureinfo. Since it's a request to a mapserver, requesting layers in 3857 will not solve my issue. – Antivist Jul 28 '15 at 13:26
  • Better to use the standard WFS getFeature - will handle reprojection for you – Ian Turton Jul 28 '15 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.