Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
what you mean by linear map? A vector layer of type Line – rashad 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
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 first. For futere read with 'vector' keyword first and books recommended on page: 'OpenLayers 2.10 Beginner's Guide' by Erik Hazzard and 'OpenLayers Cookbook' by Antonio Santiago Perez.


share|improve this answer
up vote 0 down vote accepted

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.

share|improve this answer
can you share the code?. Also the openlayer method? – Roy M J Oct 25 '13 at 9:18
For OpenLayers, please refer… You can change Tolerance factor as necessary to adjust your simplification level. There 're some PHP implementations also.… – Rajitha Bandara Oct 26 '13 at 14:33
Also check – Rajitha Bandara Oct 26 '13 at 14:39

Your Answer


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.