[R-sig-Geo] points sampled along a Line don't seem to intersect it

Mathieu Rajerison mathieu.rajerison at gmail.com
Mon Mar 30 15:25:51 CEST 2015


Ok thanks for the answer.

Your explanations are very technical as they go deep into the package's
code, and GEOS specifications.

Finally, I used spatstat::project2Segment to get my points on the lines.

Mathieu

2015-03-23 20:30 GMT+01:00 Roger Bivand <Roger.Bivand at nhh.no>:

> On Mon, 23 Mar 2015, Barry Rowlingson wrote:
>
>  On Mon, Mar 23, 2015 at 12:07 PM, Mathieu Rajerison
>> <mathieu.rajerison at gmail.com> wrote:
>>
>>> pts <- spsample(rds.un, type="regular", n=100)
>>>
>>
>> Your points are at least 3.9x10^-17 units from the lines:
>>
>> gDistance(pts, rds.un)
>> [1] 3.908727e-17
>>
>> I can only think this is due to a difference in how spsample and how
>> rgeos interpolate lines from points. FAQ 7.31 in disguise?
>>
>> I suspect you could use gBuffer on your points with a buffer width of
>> 1e-10 to get a reliable intersection, but that would be a line segment
>> (or segments if the point is close to a junction) but you could
>> possibly just take a single point from that line geometry and in the
>> worst case scenario you're only 1e-10 out...
>>
>>
> Had the fuzzyMM package been written in a modularised way (it places
> vehicle GPS positions on OSM road lines, and needs velocity etc.), it might
> have given a starting point. As Barry says, finding which road is closest
> to each point is trivial (I projected too, to get more digits), but finding
> the nearest GEOS point on the road isn't, because GEOS discretises using
> getScale() to go to an integer grid. spsample() is also very pushed to get
> n here, so the # pts is way under.
>
> If anyone would like a brain teaser, this should be attractive!
>
> Roger
>
>
>>
>> Barry
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 91 00
> e-mail: Roger.Bivand at nhh.no
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list