1

This question already has an answer here:

I have several images in EPSG:3857 which are originally from the Google maps API. I have a map layer which is based on OpenLayers v3.6 and it is in EPSG:21781. I would like to project the images from EPSG:3857 on top of EPSG:21781 layer. From the Openlayers API V3.11 there is an option to reproject at the client side on the fly with the following example code.

layers['bng'] = new ol.layer.Tile({
        source: new ol.source.XYZ({
          projection: 'EPSG:3857',
          url: 'https://tileserver.maptiler.com/miniscale/{z}/{x}/{y}.png',
          crossOrigin: '',
          maxZoom: 6
        })
      });

Since I am stuck with V3.6, I would like to convert the images at the server side and project them on top of EPSG:21781. Could someone help me with this.

marked as duplicate by radouxju, Chad Cooper, Mapperz Aug 30 '16 at 13:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Please give more context to your questions. I saw your tag for openlayer-3: is your final goal to show the image in openlayer in EPSG:21781? Are your trying to reproject before publishing your images in a webmap? Or do you want to reproject on the fly in the webmap? – Djana Aug 30 '16 at 9:33
  • why not use gdal ? – radouxju Aug 30 '16 at 9:44
  • @Djana Sorry for not posting the question clearly. Now I have edited the question. I want to reproject before publishing my images in the webmap. – Vamsi Aug 30 '16 at 10:37
  • @radouxju I am quite new to GIS and gdal, Could you please give me some hint how to use gdal for my problem. Thanks. – Vamsi Aug 30 '16 at 10:54
  • 2
    see gis.stackexchange.com/questions/174658/… for example – radouxju Aug 30 '16 at 11:03
2

If you are not familiar with gdal and the command line (see comment from @radouxju) and if you actually have the image as files (which is not clear) and referenced, you can use QGIS and a few clicks.

1) Load your image in QGIS and make sure that QGIS interpreted your image correctly as EPSG:3857 (go to the layer's properties and set the right projection system)

Method A

2) Click on the "Raster" menu, pick Projections > Wrap (reproject)

Method B

2) Right click on the image name in the layer stack, "Save As.."

3) Pick the new projection system when saving (under CRS)

PS: I am not sure what's the policy about re-using tiles from the Google API, so you should make sure you are allowed to use them for your purpose

[EDIT] If you are requesting the tiles and want to transform them on the fly (as it seems from your last comment), and you cannot do it on the client side with OL3 because you are using v3.6, then the easiest is to switch to 3.11, IMHO.

  • Thanks for the answer. I am not reprojecting Google API tiles but other tiles which are projected on top of Google API tiles. I don't have the images locally but the images are coming from the different server and I would like to reproject them on top of EPSG:21781. From EPSG:4326 to EPSG:3857 I could reproject at the client side very easily with the formula explained in the following link. wiki.openstreetmap.org/wiki/… But I am not able to find such simple solution for the EPSG:3857 to EPSG:21781 conversion. – Vamsi Aug 30 '16 at 12:45
  • Well, EPSG:4326 and EPSG:3857 are common for web mapping and similar (for their difference: (gis.stackexchange.com/questions/34276/…) ). EPSG:21781 is based on a different ellipsoid, so the transformation is not that easy. But you could use the Proj4.js (proj4js.org) library if you are looking for the reprojection parameters. – Djana Aug 31 '16 at 7:17
  • It seems I could solve my problem using Mapproxy (mapproxy.org). I will post the answer as soon as I am done with that. – Vamsi Aug 31 '16 at 13:40

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