2

I'm trying to work on to convert from a shapefile to KML however, I could not get projection correctly. I have had success converted it, but I lost the files and cannot reproduce them. The file i'm trying to convert is the shapefile coming from here: http://www.cartelec.net/?page_id=3609

I tried to do a few times with the CRS with no success, but the only one with something viewable in google earth was WGS84 but it showed my map in France in the Netherlands.

Can someone please help me to how do I get it correct?

EDIT - Content of PRJ files:

PROJCS[        

    "_MI_0",        

    GEOGCS[        

        "NAD83",        
            DATUM[        
                "D_NAD83",        
                SPHEROID["Geodetic_Reference_System_of_1980",6378137.0,298.2572221009113]        
            ],        
            PRIMEM["Greenwich",0.0],        
            UNIT["Degree",0.0174532925199433]        

    ],        

    PROJECTION["Lambert_Conformal_Conic"],        

    PARAMETER["false_easting",700000.0],        
    PARAMETER["false_northing",6600000.0],        
    PARAMETER["central_meridian",3.0],        

    PARAMETER["standard_parallel_1",44.0],        
    PARAMETER["standard_parallel_2",49.00000000001],        
    PARAMETER["latitude_of_origin",46.5],        

    UNIT["Meter",1.0]        

]
  • Do you know the projection/CRS of the shapefile data? – artwork21 Sep 13 '16 at 13:55
  • 1
    I've had a look at the PRJ files and it is not a clean CRS (very similar to Lamber 93 / RGF 93 ; EPSG=2154). You might get in touch with the contact indicated on the page (colange_celine<at>yahoo<dot>fr) in order to ask clean data... – wiltomap Sep 13 '16 at 14:09
2

CRS of the Shapefile is RGF93 / Lambert-93 (EPSG:2154) but original PRJ file contains EPSG:4171 instead. You have to assign correct CRS to the input Shapefile and then convert it to KML. You can download correctly assigned Shapefile here (or even convert to KML): https://mygeodata.cloud/drive/public#25458-fond0710

  • Thanks @Tonny! How do you assign correct CRS to the input shapefile? Did you replace the PRJ file or saved the layer as another layer with 2154 CRS? – wiltomap Sep 13 '16 at 14:37
  • I have replaced content of the PRJ file by ESRI WKT from here: epsg.io/2154 – Tonny Sep 13 '16 at 14:47
  • Good job! I did know this site but didn't thought about using it. – wiltomap Sep 13 '16 at 14:49
  • Thanks a lot ! i can't understand what you've done but it's perfect. I can convert it in kml using qgis (i don't have a plan on mygeodata) and it works like a charm ! – Lethys Sep 13 '16 at 16:39
1

You could also consider using ogr2ogr for this purposes. The following code overrides the Shapefile's project (-s_srs) and assigns the correct one (-a_srs):

ogr2ogr -f 'KML' -s_srs 'epsg:2154' -a_srs 'epsg:4326' output_4326.kml input.shp
  • 1
    According to gdal.org/drv_kml.html, the target CRS for any KML file output MUST be EPSG:4326 WGS84. – AndreJ Sep 23 '16 at 11:36
  • yes, you are correct. have updated in the answer. – dmci Sep 23 '16 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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