[Talk-it] Nuova procedura per importare i file shp: ogr2osm

Cascafico Giovanni cascafico a gmail.com
Mer 24 Set 2014 10:24:57 UTC


>
>  > (https://github.com/pnorman/ogr2osm). Ogr2osm
>

Scusate, da profano della programmazione sto provando lo script, confidando
nella semplicità del file delle translations

Funziona con i file.shp di esempio (test1.shp ecc) , ma quando provo lo shp
ISTAT dei numeri civici...


> C:\Python27>python.exe ogr2osm-master\ogr2osm.py -d
> ogr2osm-master\testfiles\shapefiles\CIVICI_RAFVG_30026.shp -t
> translations\NumeriCivici_1.py  --no-upload-false
> running with ElementTree on Python 2.5+
> Preparing to convert file
> 'ogr2osm-master\testfiles\shapefiles\CIVICI_RAFVG_30026.shp' to
> 'C:\Python27\CIVICI_RAFVG_30026.osm'.
> Will try to detect projection from source metadata, or fall back to
> EPSG:4326
> Successfully loaded 'NumeriCivici_1' translation method
> ('C:\Python27\ogr2osm-master\translations\NumeriCivici_1.pyc').
> Using default filterLayer
> Using default filterFeature
> Using user filterTags
> Using default filterFeaturePost
> Using default preOutputTransform
> Parsing data
> Detected projection metadata:
> PROJCS["SWEREF99_TM",
>     GEOGCS["GCS_SWEREF99",
>         DATUM["SWEREF99",
>             SPHEROID["GRS_1980",6378137,298.257222101]],
>         PRIMEM["Greenwich",0],
>         UNIT["Degree",0.017453292519943295]],
>     PROJECTION["Transverse_Mercator"],
>     PARAMETER["latitude_of_origin",0],
>     PARAMETER["central_meridian",15],
>     PARAMETER["scale_factor",0.9996],
>     PARAMETER["false_easting",500000],
>     PARAMETER["false_northing",0],
>     UNIT["Meter",1]]
> Traceback (most recent call last):
>   File "ogr2osm-master\ogr2osm.py", line 612, in <module>
>     parseData(data)
>   File "ogr2osm-master\ogr2osm.py", line 295, in parseData
>     parseLayer(translations.filterLayer(layer))
>   File "ogr2osm-master\ogr2osm.py", line 356, in parseLayer
>     parseFeature(translations.filterFeature(ogrfeature, fieldNames,
> reproject), fieldNames, reproject)
>   File "ogr2osm-master\ogr2osm.py", line 366, in parseFeature
>     geometries = parseGeometry([ogrgeometry])
>   File "ogr2osm-master\ogr2osm.py", line 404, in parseGeometry
>     returngeometries.extend(parseCollection(ogrgeometry))
>   File "ogr2osm-master\ogr2osm.py", line 487, in parseCollection
>     member.addparent(geometry)
> AttributeError: 'list' object has no attribute 'addparent'
>

e non viene prodotto alcun file.osm. Cos'ha di indigesto il mio shp? Devo
inserire manualmente la colonna "addr:street"?

Il file delle translations è un semplicissimo:


> def filterTags(attrs):
>     if not attrs:
>         return
>     tags = {}
>     if 'DENOMINAZI' in attrs:2927
>         tags['addr:streetname'] = attrs['DENOMINAZI']
>     return tags
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk-it/attachments/20140924/2615d4ae/attachment.html>


Maggiori informazioni sulla lista Talk-it