Skip to content

Commit

Permalink
Update to OSM plugin from Lukas Berka:
Browse files Browse the repository at this point in the history
-displaying recommended tag keys and values for easier tags editing
-created features now doesn't have created_by tag automatically (coz it's deprecated)
-eh, names of some dockwidget elements are shorter now :)


git-svn-id: http://svn.osgeo.org/qgis/trunk@11283 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Aug 6, 2009
1 parent cc05d67 commit 8a7b9c4
Show file tree
Hide file tree
Showing 4 changed files with 812 additions and 343 deletions.
11 changes: 0 additions & 11 deletions python/plugins/osm/DatabaseManager.py
Expand Up @@ -43,7 +43,6 @@ def __init__(self,plugin):

self.plugin=plugin
self.canvas=plugin.canvas
self.pluginName="QGIS OSM v0.4"

self.dbConns={} # map dbFileName->sqlite3ConnectionObject
self.pointLayers={}
Expand Down Expand Up @@ -420,7 +419,6 @@ def createPoint(self,mapPoint,snapFeat,snapFeatType,doCommit=True):
c=self.getConnection().cursor()
c.execute("insert into node (id,lat,lon,usage,status) values (:nodeId,:lat,:lon,0,'A')"
,{"nodeId":str(nodeId),"lat":str(mapPoint.y()),"lon":str(mapPoint.x())})
self.insertTag(nodeId,"Point","created_by",self.pluginName,False)
c.close()

if doCommit:
Expand Down Expand Up @@ -470,9 +468,6 @@ def createPoint(self,mapPoint,snapFeat,snapFeatType,doCommit=True):
elif snapFeatType=='Polygon':
self.changePolygonStatus(snapFeat.id(),"N","U")

# insert created_by tag of the new point
self.insertTag(nodeId,"Point","created_by",self.pluginName,False)

# finishing
c.close()

Expand Down Expand Up @@ -541,7 +536,6 @@ def createLine(self,mapPoints, doCommit=True):
c.execute("insert into node (id,lat,lon,usage,status) values (:nodeId,:lat,:lon,1,'A')"
,{ "nodeId":str(nodeId),"lat":str(lat),"lon":str(lon) })

self.insertTag(nodeId,"Point","created_by",self.pluginName, False)
affected.add((nodeId,'Point'))

# insert record into table of way members
Expand All @@ -556,8 +550,6 @@ def createLine(self,mapPoints, doCommit=True):
c.execute("insert into way (id,wkb,membercnt,closed,min_lat,min_lon,max_lat,max_lon,status) values (?,?,?,0,?,?,?,?,'A')"
,(str(lineId),sqlite3.Binary(""),str(cnt),str(minLat),str(minLon),str(maxLat),str(maxLon)))

self.insertTag(lineId,"Line","created_by",self.pluginName, False)

# finishing...
c.close()
feat=QgsFeature(lineId,"Line")
Expand Down Expand Up @@ -623,7 +615,6 @@ def createPolygon(self,mapPoints, doCommit=True):
c.execute("insert into node (id,lat,lon,usage,status) values (:nodeId,:lat,:lon,1,'A')"
,{ "nodeId":str(nodeId),"lat":str(lat),"lon":str(lon) })

self.insertTag(nodeId,"Point","created_by",self.pluginName, False)
affected.add((nodeId,'Point'))

# insert record into table of way members
Expand All @@ -638,8 +629,6 @@ def createPolygon(self,mapPoints, doCommit=True):
c.execute("insert into way (id,wkb,membercnt,closed,min_lat,min_lon,max_lat,max_lon,status) values (?,?,?,1,?,?,?,?,'A')"
,(str(polygonId),sqlite3.Binary(""),str(cnt),str(minLat),str(minLon),str(maxLat),str(maxLon)))

self.insertTag(polygonId,"Polygon","created_by",self.pluginName, False)

# finish
c.close()
feat=QgsFeature(polygonId,"Polygon")
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/osm/DlgUploadOSM.py
Expand Up @@ -917,7 +917,7 @@ def __createChangeset(self):
userCommentBytes=userComment.toUtf8()

# create http request's body (create XML with info about uploaded way)
requestXml=QString("<osm>\n<changeset>\n<tag k=\"created_by\" v=\"qgis plugin\"/>\n<tag k=\"comment\" v=\""+userCommentBytes.data()+"\"/>\n</changeset>\n</osm>")
requestXml=QString("<osm>\n<changeset>\n<tag k=\"created_by\" v=\"QGIS OSM v0.4\"/>\n<tag k=\"comment\" v=\""+userCommentBytes.data()+"\"/>\n</changeset>\n</osm>")

# send prepared request
requestBytes=requestXml.toAscii()
Expand Down

0 comments on commit 8a7b9c4

Please sign in to comment.