3

What's the difference between the two flags -a_srs and -s_srs. From what I read they both define the EPSG the Input-File has. When using -s_srs ogr2ogr says that -t_srs must be used as well. But when setting -a_srs instead of -s_srs it runs without -t_srs.

6

From the ogr2ogr page:

-a_srs srs_def: Assign an output SRS
-t_srs srs_def: Reproject/transform to this SRS on output
-s_srs srs_def: Override source SRS

So we can see they have very different functions. -s_srs tells OGR to ignore the SRS that the input source claims to have and use the one provided. This is useful when OGR is unable to determine the SRS of an input or it is just plain wrong. -a_srs sets the provided SRS of the output source (and again assumes you know what you are doing). -t_srs instructs ogr2ogr to reproject the data but to do this it must know what the input SRS is.

| improve this answer | |
  • Thank your for your answer. I still don't get why I can't use the -s_srs without the -t_srs because I think it should just assume that the target srs should be the same like the input .. Giving the source srs should (in my thinking) be optional and not affect the output. – Leo.1906 Jul 14 '16 at 12:44
  • we'd probably need to see the whole command line to answer that – Ian Turton Jul 14 '16 at 12:45
  • ogr2ogr.exe -f "GeoJSON" "C:\Users\root\Desktop\Plugin_new\Shapefiles_Karte\Landkreise\Bundeslaender.geojson" "C:\Users\root\Desktop\Plugin_new\Shapefiles_Karte\Landkreise\Bundeslaender.shp" -s_srs "EPSG:3068" -overwrite So I would assume that ogr should create the output as well as EPSG:3068 ... – Leo.1906 Jul 14 '16 at 12:48
  • by default GeoJSON is in epsg:4326 – Ian Turton Jul 14 '16 at 12:51
  • ah ok .. didn't knew this. And I mean it's no problem to set the t_srs as well. I was just curious about it – Leo.1906 Jul 14 '16 at 13:01

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.