2

So I've got a shapefile that has polygons of countries, with coordinates in decimal degrees:

 Country (String) = Algeria
 POLYGON ((6.928073999999953 36.88360652,
           6.949973999999969 36.883306519999991, ...

gdalsrsinfo on the .prj file outputs:

PROJ.4 : '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs '

PROJCS["Mercator",
    GEOGCS["GCS_unnamed ellipse",
        DATUM["unknown",
            SPHEROID["Unknown",6378137,0]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["Meter",1],
    PARAMETER["latitude_of_origin",0.0]]

To my untrained eye, the GEOGCS[] bit looks like it's defining the coordinate system in degrees, so this should work. However, if I include the .prj file, Google Maps Engine thinks the coordinates are in meters and renders everything as a tiny blob around (0,0). If I drop the .prj file, it defaults to degrees and returns a much more sensible rendering.

What's wrong, and how do I fix it? (Note the the shapefile is from a third party and produced with an unknown toolset.)

3
  • It's in Mercator projection but with no parameters. That definitely doesn't match the coordinates in the polygon. I say ignore the projection file. Commented Jul 30, 2014 at 4:17
  • Thanks, but could you expand on that a bit? Why would Mercator default to meters, and what parameters are missing? Commented Jul 30, 2014 at 4:23
  • Here is an article on the Mercator projection en.wikipedia.org/wiki/Mercator_projection. The first parameter is PROJGCS which instructs that this is a projected (UNIT["Meter",1]) coordinate system but central meridian, false easting and northing and lattitude of origin are missing, usually they would have values. Here the first word is important, PROJCS for projected and GEOGCS for geographic. Commented Jul 30, 2014 at 4:33

1 Answer 1

4

The projection part of the .prj file declares units as meters, so that is what you get.

If your data is in degrees, you have to use a .prj file for EPSG:4326:

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

without any projection information.

Looking at the coordinates you supplied, the .prj file is definitely wrong. Just delete it, and create a new one with the data I included.

2
  • 2
    Assuming that the data is in WGS84. Otherwise you might need to do some digging to find out what coordinate system it really is. Compare against known-accurate features like basemaps/google and decide if WGS84 is correct or close enough or whether to delve further. Commented Jul 30, 2014 at 4:37
  • The coordinates fit quite good to WGS84 for the Algerian coastline.
    – AndreJ
    Commented Jul 30, 2014 at 4:47

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.