Database Reference
In-Depth Information
# format is
# ('Via delle Sette Chiese', 0.0,
'POINT(12.5002166330412 41.859774874774)')
point_wkt = geocoded_street[2]
point =
ogr.CreateGeometryFromWkt(point_wkt)
# we create a LayerDefn for the
feature using the one from the layer
featureDefn = pg_layer.GetLayerDefn()
feature = ogr.Feature(featureDefn)
# now we store the feature geometry
and the value for the name field
feature.SetGeometry(point)
feature.SetField('name',
geocoded_street[0])
# finally we create the feature (an
INSERT command is issued only here)
pg_layer.CreateFeature(feature)
10. RuntheprecedingscriptandthencheckwithyourfavoritePostgreSQLclient
orwithaGISDesktoptoolwhetherthepointsforthestreetnameswerecor-
rectly geocoded:
(postgis-cb-env)capooti@ubuntu:~/
postgis_cookbook/working/chp08$ python
geocode_streets.py
Table created.
Via Delle Sette Chiese
('Via delle Sette Chiese', 0.0,
'POINT(12.5002166330412 41.859774874774)')
...
Via Cavour
('Via Cavour', 0.0,
'POINT(12.7519263341222
41.9631244835521)')
Search WWH ::




Custom Search