Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've made a vector grid using lines; the grid coverage is 100 km x 100 km and the lines are at vertical and horizontal intervals of 1000 metres. Each line in the grid is defined by two vertices, one at each end, and each line has an ordinate attribute for labelling.

My wish is to to add vertices to the lines, so that each line will have vertices at intervals of (say) 500 metres. Does anyone know how to do this?

The background to this is that the grid will be displayed on OpenLayers and given the strangeness of Google Mercator the lines need to be pegged to the ground with vertices at frequent intervals. One other obvious use for the ability to add vertices to grid lines would also be to make nicely curved lat/lon graticules for projected maps.

share|improve this question
1  
Hmmm. I see you've marked an accepted answer below, but it doesn't answer the question of adding 'vertices ... every x metres'. Densify adds n vertices per line. If you had a grid of equal-length lines you could do a one-off calculation and run densify to add (length / x) vertices, but what of a layer with variable length lines? –  Simbamangu Sep 30 '12 at 11:35
    
Well yes, but the answer made my problems go away. I understand your confusion, the original title of the question was simply 'Add vertices to lines'. N. –  nhopton Sep 30 '12 at 12:19
    
Reviewing the edit I see it's changed the meaning of the title! Apologies ... looking for a similar solution, may add a separate question. –  Simbamangu Sep 30 '12 at 12:25
add comment

2 Answers 2

up vote 7 down vote accepted

in Qgis 1.8.0 there is a densify function but i don't know if it has distance parameter like in Arcgis

share|improve this answer
    
Densify! It was me who was being dense. This works fine, many thanks. My Ordnance Survey grid lines now plot perfectly on OpenLayers mapping, with grid labels. Nick. –  nhopton Jul 15 '12 at 17:37
add comment

If I understand you correctly, you want to add midpoints (as your example). I would:

  • copy the grid layer
  • move it by (500, 500)
  • calculate the intersections
  • find out how to split the original grid with them (a simple union?)

For any other fraction, the process would have to be repeated multiple times, so it is far from efficient. I would probably fallback to scripting PostGIS and its ST_Split functionality.

share|improve this answer
    
Thanks for this. In the end I used 'densify' which worked very nicely. Nick. –  nhopton Jul 15 '12 at 17:39
    
Great, glad there is a simpler way. :) –  lynxlynxlynx Jul 15 '12 at 20:09
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.