Tuesday, 15 May 2018

Using Google Maps Coordinate System in QGIS?


I have some Points in Shapefile with BC Albers Coordinate Syetem and I need to Project them to Google Maps Lat and Long. I tried to do this by using


WGS 84 / Pseudo Mercator EPSG: 3857

and


WGS84 EPSG: 4326


But none of them returning correct result! I believe there is Coordinate for Google Maps in ArcGIS as "Web Mercator" to do this but I couldn't find it in QGis.


What Coordinate should I use for Getting correct points X and Y on google map?


I also used EPSG:900913 Google Mercator but when I tried to get X and Y coords through Geometry Tool/ Export add Geometry Columns I am getting numbers like :


enter image description here


Result using EPSG:3857:


enter image description here



Answer



What you need to do is first display your CSV in the proper coordinate system (BC Albers) so QGIS can then re-project it to Google Maps Mercator (3857).


EPSG:3857 -- WGS84 Web Mercator (Auxiliary Sphere) is what you want.



So what you need to do is add your CSV to QGIS using 'Layer > Add Layer > Add Delimited Text Layer'.


Choose the default options in the first window:


enter image description here


The next window will ask you what coordinate system you want to use to display your X and Y values. You know it is in BC Albers, so choose that option in the dialogue box:


enter image description here


Now your points - still in BC Albers - will display in QGIS - but this is tricky because you will have a hard time displaying the various OpenLayers backgrounds with this data.


Here are the points on their own:


enter image description here


The last step is to actually re-project your data to Google Maps projection


Right-click the sample (CSV / delimited) layer in QGIS > Save As



Format: ESRI Shapefile
Save as: give your new SHP a name
CRS: Selected CRS > choose EPSG:3857 WGS84 / Psuedo Mercator**


Click OK to export and re-project your CSV to SHP in 3857


Now create a new map (to reset the coordinate system of the QGIS project)


Add your SHP you saved, and from the Web > OpenLayers menu add one of the basemaps:


enter image description here


That should do it!


Updates:


**The difference between EPSG:3857 and EPSG:3785 in QGIS is confusing, and I'm not exactly sure what the purpose of 3785 is... Most if not all web map systems are published using EPSG:3857 yet in QGIS the description for 3785 is "Popular Visualization CRS / Mercator" and the description for the CORRECT web mercator is "WGS 84 / Pseudo Mercator". I will take up this issue somewhere else!



Update #2: I see in this thread that 3785 is the deprecated version of the 'google maps' coordinate system... I hope QGIS can make note of this soon...


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...