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 have two sets of data. One with placemarks represented by blue dots in image below, and another set of geographic data with lines represented by grey lines.

1) For the first point in drawing, I'm looking for a way for automatically connecting placemarks, by adding new lines geometry between them, but not crossing grey lines (representing streets in fact). In drawing, green connections are connections wanted, and red connections are unwanted ones.

2) This second point is maybe more difficult to achieve. Connections between two dots should not exist if they're not "following" (maybe by having roughly the same angle of) the grey lines.

Is it possible to play with data to solve this problem by playing with QGIS, or another tool, and save new lines in database?


P.S.: I'm new to GIS world.

share|improve this question
Does the point data contain any information/attributes that identify individual points as belonging to a group? Similarly, do the points contain information identifying the order in which they were laid out? – Radar Nov 1 '12 at 20:42
adding more detail to what @Radar asked, if you have say streetname and address attached to the points, you could use that data to help 1) only connect points with the same streetname together, 2) order your data sequentially (by address number, or even/odd address numbers so they dont cross a street, and 3) provide line virtual breakpoints between blocks (only connect lines from 100-199, 200-299, etc). Does that pretty much describe what you are trying to accomplish? – RyanDalton Nov 1 '12 at 22:11
Point data do contain attributes, but not related to each others, also not related to street or address. They have latitude and longitude plus a few more attributes that don't group them. And they don't contain info identifying order, only an ID but two points next to each other does not necessarily have a contiguous order. Streets are containing information like their names. – elbaid Nov 2 '12 at 1:13
A suggestion for #1: you can create a polygon for the entire area, split it by streets, so you get polygons for each group. Then using Spatial join you can assign a value to points for each group which will help you in #2. – nadya Nov 2 '12 at 4:13

The below is a concept only and I am not sure whether it would work, but I found it interesting to think about.

Do you have access to Oracle database with Spatial on it? If the job is a one-off and you don't have Oracle "in-house", maybe you could use Oracle's development virtual machine ( with all the bits already installed and ready to play with. I am not sure about the licenses though - you'd have to check.

Anyway, assuming that the points are in POINTS table and lines in LINES table, and both tables have ID and GEOM columns, the following query should return pairs of points parallel to the grey lines, together with the distance between the points.

select,, sdo_geom.sdo_distance(A.geom, B.geom, :T) as pts_dist 
from points A, points B, lines L
where <>
  and sdo_geom.sdo_distance(A.geom, L.geom, :T) = sdo_geom.sdo_distance(B.geom, L.geom, :T)
  and sdo_geom.sdo_distance(A.geom, L.geom, :T) < :X
  and not exists 
      (select 1 from lines L1
       where sdo_geom.relate(L1.geom, 'ANYINTERACT', 
             mdsys.sdo_geometry(/* params to create a line between A and B */), :T)) = 'TRUE')

I haven't tested it at all. The result would still have to be processed, because you would get: a) two links for each pair of points - from A to B and from B to A; b) if there are 3 or more points along a grey line, you'd get links between all of them - I think the solution would be, for the given point A to choose the shortest link from this point and ignore/remove the rest (that's what the distance is for in the result).

The parameters used in this query: T - tolerance (e.g. 0.005); X - the max distance between the point and the grey line - parallel points positioned too far from the grey line would not be taken into account (for this line).

The query could be changed to compare the distance of A from the line and distance of B from the line with some "error buffer", so if two points are "almost" parallel, they still would be taken into the result.

The query is probably not optimal and might take quite long to execute. But again, its a concept only and if you decide to try it out, I am sure there is a lot to do.

share|improve this answer

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.