I'm new to GIS programming and I'm using OpenLayers for my GIS project. I want to know how to draw a linear map programmatically between two locations from a real geographical map (may be OpenLayers). I think there should be a projected coordinate system for this. Is there any distance mapping algorithm to accomplish this task?

I do not mean adding a vector layer to an existing map. I want create a separate line map looking at a real geo map (Obviously a path connecting two locations).

Original map

original map

Linear map

linear map

  • 5
    what you mean by linear map? A vector layer of type Line – rkm Jan 10 '13 at 10:57
  • do you mean map where line is draw with heigth(y) and length(x) ? – simplexio Jan 14 '13 at 7:28
  • Actually I can't understand the line heigth(y) and length(x). If it is geodesic line on map, that's not what I need. – Rajitha Bandara Jan 15 '13 at 8:47
  • you want to find the (x,y) at a specific distance between two geographic points? did you mean linear referencing? – vinayan Jan 15 '13 at 10:41
  • 1
    or you simply want to plot a striaght line on the map between two points? – vinayan Jan 15 '13 at 11:03

I know that asking the questions is easier than read documentation and evaluate examples. Try to read source of http://openlayers.org/dev/examples/vector-features.html first. For futere read http://openlayers.org/dev/examples/ with 'vector' keyword first and books recommended on http://openlayers.org page: 'OpenLayers 2.10 Beginner's Guide' by Erik Hazzard and 'OpenLayers Cookbook' by Antonio Santiago Perez.



I found a solution using Douglous Peuker algorithm which can be used to reduce the number of vertices with a tolerance factor and generate a simple linear map while maintaining network topology. PostGIS ST_Simplify function has been implemented on top of this algorithm. There 's also an OpenLayers implementation of this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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