Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am working on a GIS Application. What progress i have done is that i have loaded a KML Layer on Google MAPS API and i am plotting the routes between the points. This is GUI Part. Now how do i save the latitudes and longitudes which i click on the maps in database and later on retreive them to display it on the maps??. I am using POSTGRE SQL as Database and Google Maps API for plotting the points. Should i capture the latitudes and longitudes on onclick function? And after capturing what are the next steps?. And what datatype can be used to capture Geospatial Data in PostgreSql. Please guide.

share|improve this question
add comment

1 Answer

You can use Geography or Geometry datatype to store your polylines. Take a look at this page if you're not familiar with them. As you write it, you can capture latitude and logitude of each clicked point during onclick event, then construct your object and store it in your DB.

Depending on your needs, you can also determine that a polyline is a list of points, which are defined by a latitude and a longitude. Create a table with three fields (idRoute / lat / lng) and store all your points in this table. Then, to display your route in your map, just load all the points where idRoute = route you want to display.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.