[Qgis-user] regularly spaced address markers on alternating side of road

Dan Jacobson jidanni at jidanni.org
Thu Jun 30 09:31:00 PDT 2016


OK I found
http://postgis.refractions.net/documentation/manual-svn/reference.html#Linear_Referencing

So I should:
1. Learn how to import my vector roads from .kmz into postgis. (I'll Google that.)

2. Use http://postgis.net/docs/ST_Length.html to get the length (L in meters) of each
of my roads.

3. Write the equivalent of perl:
for($i=0; $i <= 1; $address++, $i += 25/$L){print ST_Line_Interpolate_Point $i;}

4. Make / print a label ($address) at that point.

5. For extra bonus, figure out to offset the label:
perpendicular to the road at 3 * ($address % 2 ? -1 : 1) meters.

Thanks.

>>>>> "RH" == Régis Haubourg <regis.haubourg at gmail.com> writes:

RH> Hi Dan, 

RH> Usually, I solve this with postgis or sqlite view, using Linear
RH> Referencing functions. I just create a view or a query of
RH> spatialised vertices. Some SQL magic could also calculate rotation
RH> and offset in additional fields to align labels with the lines. 
RH> Cheers Régis 



More information about the Qgis-user mailing list