0

Trying to add to my map an WMS layer with custom projection

When executing, the map does not show any layer.

Custom projection:

proj4.defs("EPSG:25830","+proj=utm +zone=30 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
register(proj4);
const customproj = getProjection('EPSG:25830');

WMS Layer:

var layer = 
  new TileLayer({
    source: new TileWMS({
      url: 'https://idena.navarra.es/ogc/wms',
      params: {'LAYERS': 'catastro'},
      projection: customproj
    })
  });

Map:

var map = new Map({
  target: 'map',
  layers: [layer],
  view: new View({
    projection: customproj,
    center: fromLonLat([-1.629950,42.63]),
    zoom: 9
  })
});

What's wrong here?

3
  • 1
    The map iis currently centered to default EPSG:3857 coordinates, it should be center: fromLonLat([-1.629950,42.63], customproj),
    – Mike
    Commented Aug 30, 2019 at 9:53
  • You are right! Answer the question for marking it as solution @Mike
    – Iñigo
    Commented Aug 30, 2019 at 9:56
  • Not sure it's correct to say custom projection for an EPSG defined CRS epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::25830
    – nmtoken
    Commented Aug 30, 2019 at 16:02

1 Answer 1

0

The map iis currently centered to default EPSG:3857 coordinates, it should be center: fromLonLat([-1.629950,42.63], customproj),

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.