Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Created September 25, 2010 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilleiguaran/597030 to your computer and use it in GitHub Desktop.
Save guilleiguaran/597030 to your computer and use it in GitHub Desktop.
indices = res.result
ruta = []
indices.each do |fila|
id = fila[0]
res = @@pgconn.exec "SELECT ST_AsText(the_geom) as texto FROM vertices_tmp WHERE id = #{id};"
coord = [ res.result[0][0].gsub("POINT(","").gsub(")","").split(" ")[1].to_f,
res.result[0][0].gsub("POINT(","").gsub(")","").split(" ")[0].to_f ]
ruta << coord
end
ruta.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment