VirtualRouting with PointFrom, PointTo

41 views
Skip to first unread message

YoBa

unread,
Feb 19, 2022, 9:17:01 AM2/19/22
to SpatiaLite Users
Hello Sandro,

I mentionned something strange in the new VirtualRouting interface. I only experience the problem with very short routes.

Here is a small example that shows the problem. It is based on a network based on openstreetmap (Belgian map):

import geopandas as gpd
from shapely import wkt
from shapely.ops import nearest_points

routing.database.execute('''UPDATE interpol_net SET Options = 'NO LINKS',tolerance=30.0 ''')

route=gpd.read_postgis('''
select algorithm,
       role,
       tolerance,
       cost,
       asWkt(st_transform(pointFrom,31370)) as pointFrom,
       asWkt(st_transform(pointTo,31370)) as pointTo,
       st_length(st_transform(geometry,31370)) as ms_length,
       asBinary(st_transform(geometry,31370)) as geometry
from interpol_net
where pointFrom=st_transform(makePoint(158551,157209,31370),4326)
  and pointTo=st_transform(makePoint(158419,157303,31370),4326)
''',routing.database,geom_col='geometry')

street=route.loc[0,'geometry']

pointFrom=wkt.loads(route.loc[0,'pointFrom'])
pointTo=wkt.loads(route.loc[0,'pointTo'])

gpd.GeoSeries([street,pointFrom,pointTo]).plot(figsize=(10,10))


Here is the output:

sandro.png

As you can see, we have a small "u-turn like" located in the upper left corner of this picture. I always have such a "u-turn" when trying to find a very short route.

To be honest ... I'm trying to use these short routes to interpolate some address locations. So, you have probably never come across such a problem.

Best regards,

Youri

PS: Thank you so much for this awesome application. We use spatialite a lot, here, at Statistics Belgium. We love it !
Reply all
Reply to author
Forward
0 new messages