I have a dataset with start and end points of lines. Columns in the table are

unique_line_id, line_start_point_lat, line_start_point_lon, line_end_point_lat, line_end_point_lon

I need to use this in my website (python,mysql) to draw lines as map overlays connecting these points.

  • According to the user selection, the map will display one or more lines from the above table
  • I need to zoom the map to fit the line/lines in the view when the page is loaded, and center the map accordingly
  • I would like to add a small thumbnail image in the middle of each line

I am looking for open source technologies to use in my website which would not need a paid license. (I have a vague idea to use google maps as base map images and use google JS API or D3.js, I've also seen references to GeoDjango) Please let me know any demo sites too, with one or more of these implemented.


As a starting point, you don't need to use geodjango for this! You could simply return unique_line_id, line_start_point_lat, line_start_point_lon, line_end_point_lat, line_end_point_lon as a json object and display these using Leaflet. You will need to structure the data to match the format required - here's an answer that explains how to load a polyline. With Leaflet you can adjust the bounds of the map to fit all of the objects returned.

Once you get this working, if there are limitations you could use geodjango to improve the approach. Instead of having separate columns for lat and lon, you could store a point object which contains the lat/lon as part of this object. Or you could store the entire line is a line object. For now, I recommend getting a minimal version working so that you can understand how the pieces fit together.

|improve this answer|||||

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