- conn = PG::Connection.new(:host => DBHOST, :port => DBPORT, :dbname => DBNAME)
- doc.find('//way/nd').each do |node|
- node_id = node['ref'].to_i
- unless nodes.include? node_id
- # this is a node referenced but not added, modified or deleted, so it should
- # still be in the postgis DB.
- res = conn.query("select lon, lat from #{DBTABLE} where id=#{node_id};")
-
- # loop over results, adding tiles to the change set
- res.each do |row|
- point = Proj4::Point.new(row[0].to_f / 100.0, row[1].to_f / 100.0)
- nodes[node_id] = tile_from_merc(point, MAX_ZOOM)
- end
+ node_cache = NodeCache.new(NODE_CACHE_FILE)
+ doc.find("//way/nd").each do |node|
+ node_id = node["ref"].to_i
+
+ next if nodes.include? node_id