pnorman / ogr2osm

pnorman's version of UVM's Rewrite of ogr2osm
Other
78 stars 46 forks source link

Not working with PROJ.4 string #12

Closed naoliv closed 11 years ago

naoliv commented 11 years ago

Still with http://people.debian.org/~naoliv/misc/shape-ogr2osm.tar.bz2 it seems that there is a problem when using PROJ.4 strings. Normal run:

$ ./ogr2osm.py ../SP_USINAS.SHP                                                                           
running with lxml.etree
Preparing to convert file '/tmp/d/SP_USINAS.SHP' to '/tmp/d/ogr2osm/SP_USINAS.osm'.
Will try to detect projection from source metadata, or fall back to EPSG:4326
Using default translations
Using default filterLayer
Using default filterFeature
Using default filterTags
Using default filterFeaturePost
Using default preOutputTransform
Parsing data
Detected projection metadata:
GEOGCS["GCS_South_American_1969",
    DATUM["South_American_Datum_1969",
        SPHEROID["GRS_1967_Modified",6378160.0,298.25]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.0174532925199433]]
Merging points
Making list
Checking list
Outputting XML

With string:

$ ./ogr2osm.py -v -p "+proj=utm +zone=23 +south +ellps=GRS67 +towgs84=-66.87,4.37,-38.52" ../SP_USINAS.SHP
running with lxml.etree
Preparing to convert file '/tmp/d/SP_USINAS.SHP' to '/tmp/d/ogr2osm/SP_USINAS.osm'.
Will use the PROJ.4 string: +proj=utm +zone=23 +south +ellps=GRS67 +towgs84=-66.87,4.37,-38.52
Using default translations
Using default filterLayer
Using default filterFeature
Using default filterTags
Using default filterFeaturePost
Using default preOutputTransform
Parsing data
Merging points
Making list
Checking list
Outputting XML

and the result is very different. Nothing visible with JOSM and only this inside the file:

<?xml version="1.0"?>
<osm version="0.6" upload="false" generator="uvmogr2osm"><node lat="-89.999400039" visible="true" lon="176.260998507" id="-1"><tag k="USINA_ID" v="         37"/><tag k="NOME" v="3 IRMAOS"/><tag k="PROPRIET_R" v="CESP - COMPANHIA ENERG&#201;TICA DE S&#195;O PAULO"/><tag k="LONGITUDE" v="         -51.312800"/><tag k="GEO_ID" v="         37"/><tag k="SITUA__O" v="EM CONSTRU&#199;&#195;O"/><tag k="LATITUDE" v="         -20.680400"/><tag k="POT_NCIA" v="1.292.000 kM"/></node></osm>
pnorman commented 11 years ago

The shapefile isn't in UTM. Looking at the data it's in longlat.

If you need to manually specify a +towgs84 parameter that differs from any of the normal EPSG codes I believe +proj=longlat +ellps=GRS67 +towgs84=-66.87,4.37,-38.52 is what you want.

pnorman commented 11 years ago

The output being a single node comes from using the wrong projection and all the nodes being projected to the same point within rounding errors.

naoliv commented 11 years ago

Right. Thank you very much!