[Qgis-user] how does QGIS generate the EPSG from a Shapefile?

Rodrigo Mariano rodrigo.mariano at inpe.br
Sun Oct 28 11:15:48 PDT 2018


Hello Jorge,


When I used your command like, the ogr showed this message:

"Layer name: DEINFO_CEMITERIOS
Geometry: Polygon
Feature Count: 42
Extent: (317568.093609, 7361463.898064) - (357756.090027, 7412287.112520)
Layer SRS WKT:
PROJCS["SAD69_UTM_zone_23S",
     GEOGCS["GCS_SAD69",
         DATUM["South_American_Datum_1969",
             SPHEROID["GRS_1967_Modified",6378160,298.25]],
         PRIMEM["Greenwich",0],
         UNIT["Degree",0.017453292519943295]],
     PROJECTION["Transverse_Mercator"],
     PARAMETER["latitude_of_origin",0],
     PARAMETER["central_meridian",-45],
     PARAMETER["scale_factor",0.9996],
     PARAMETER["false_easting",500000],
     PARAMETER["false_northing",10000000],
     UNIT["Meter",1]]
ID: Integer64 (10.0)
NOME: String (60.0)
AREA: Real (20.2)
DEPADM: String (10.0)"

When I opened the Shapefile with the QGIS, the software chose the EPSG 
29193.

But when I use the ogr2ogr to insert the Shapefile in my database, the 
OGR choose a strange EPSG.
For that reason, I normally open the Shapefile with the QGIS and I pass 
explicitily the EPSG on ogr2ogr command line.
Because of that I would like to know how the QGIS discover the EPSG 
given a .prj.

The .prj of that Shapefile is:

"PROJCS["SAD69_UTM_zone_23S",GEOGCS["GCS_SAD69",DATUM["D_South_American_1969",SPHEROID["GRS_1967_Truncated",6378160,298.25]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-45],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]"

Best Regards,

Rodrigo


On 25/10/2018 15:59, Jorge Gustavo Rocha wrote:
> Oi Rodrigo,
>
> Can you run ogrinfo in the command line? Like:
>
> ogrinfo -al -so yourshape.shp
>
> This will tell you the CRS detected by ogr.
>
> ogr (and QGIS) uses the *.prj file. But there are known problems with
> the WKT representation of CRS. Sometimes it is hard to know if two
> different strings represents the same EPSG code.
>
> For that reason, QGIS also writes and additional *.qpj. When it is
> present, QGIS uses this textual representation to compare it against its
> database and it always work.
>
> But if you just have the *.prj along with the shapefile, both ogr and
> QGIS might fail to detect the exact CRS.
>
> Please share one *.prj that ogr fails to associate with a known EPSG.
>
> Abraço,
>
> Jorge
>
> Às 13:27 de 25/10/18, Rodrigo Mariano escreveu:
>> Hello everyone,
>>
>> I would like to know: how does QGIS generate the EPSG from a Shapefile?
>>
>> I ask this question, because I'm trying to upload a Shapefile by OGR,
>> but the OGR doesn't
>> insert the correct EPSG. So I need always open the Shapefile in QGIS to
>> discover the
>> EPSG before uploading it with OGR.
>>
>> Thanks in advance.
>>
>> Best Regards,
>>
>> Rodrigo
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> J. Gustavo


More information about the Qgis-user mailing list