3liz / lizmap-pgrouting-module

PgRouting module for Lizmap
https://docs.3liz.org/lizmap-pgrouting-module/
6 stars 8 forks source link

Add "TRONCON_DE_ROUTE.shp" to the sample project #47

Closed gioman closed 9 months ago

gioman commented 9 months ago

While following

https://github.com/3liz/lizmap-pgrouting-module/blob/master/docs/configuration.md

the queries to create the nodes and edges tables are depending on having imported the line vector contained in the mentioned shapefile, but this vector is not found inside

https://demo.lizmap.com/lizmap/index.php/view/media/getMedia?repository=modules&project=pgrouting&path=/media/pgrouting.zip

That zip file contains indeed the SQL with the INSERT statements for the nodes and edges tables, but there aren't the CREATE TABLE ones to create the necessary structure for this tables.

Gustry commented 9 months ago

Tables are created by the installation https://github.com/3liz/lizmap-pgrouting-module/blob/master/pgrouting/install/sql/install.pgsql.sql#L26 L26 and L33

Did you run the installation process completely ?

gioman commented 9 months ago

@Gustry this

https://github.com/3liz/lizmap-pgrouting-module/blob/master/docs/import/import_french_bdtopo_to_pgrouting.sql

implies this

ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:'service=lizmap-pgrouting active_schema=bdtopo' -lco DIM=2 -append -lco GEOMETRY_NAME=geom -lco FID=gid -nln bdtopo.troncon_de_route -t_srs EPSG:2154 -nlt PROMOTE_TO_MULTI "TRONCON_DE_ROUTE.shp"

from

https://github.com/3liz/lizmap-pgrouting-module/blob/master/docs/configuration.md

but "TRONCON_DE_ROUTE.shp" is no part of the repo, nor the Zipped sample project.

Gustry commented 9 months ago

TRONCON_DE_ROUTE.shp is an example, from the French GIS data provider. You should adapt this with your own data. https://docs.3liz.org/lizmap-pgrouting-module/configuration/

You need to populate pgrouting.edges, pgrouting.nodes with your own workflow.

gioman commented 9 months ago

TRONCON_DE_ROUTE.shp is an example, from the French GIS data provider.

@Gustry yes that is clear, but for testing purposes (to understand how the module works and how the data must be structured) it would be very good to have access to such sample. Is that data not redistributable?

gioman commented 9 months ago

@Gustry to get a practical idea on how these columns must actually be filled

https://github.com/3liz/lizmap-pgrouting-module/blob/master/docs/configuration.md#import-the-road-data-into-pgrouting-graph-nodes-and-edges

Gustry commented 9 months ago

Indeed, the data is not available because it was project specific (and country specific).

There is the sample demo : https://demo.lizmap.com/lizmap/index.php/view/map?repository=modules&project=pgrouting

The data contains only INSERT, because tables are created by the installation process of the module.

mdouchin commented 9 months ago

At present, original data can be found here: https://geoservices.ign.fr/telechargement?bdd%5B0%5D=233&bdd%5B1%5D=233 source : https://www.data.gouv.fr/fr/datasets/bd-topo-r/

gioman commented 9 months ago

At present, original data can be found here: https://geoservices.ign.fr/telechargement?bdd%5B0%5D=233&bdd%5B1%5D=233 source : https://www.data.gouv.fr/fr/datasets/bd-topo-r/

@mdouchin thanks! that helps a lot, also because not everyone has access to such good public data (i.e. here there is no public, good, topologically correct transportation dataset), so having a real example as a starter is very important.

Notes:

https://github.com/3liz/lizmap-web-client/issues/4030

do not seem to work, files are always served with 0 bytes size.

https://geoservices.ign.fr/bdtopo#telechargementshpreg

but the format to be downloaded/used is GPKG not Shapefile, otherwise the SQL script here

https://docs.3liz.org/lizmap-pgrouting-module/configuration/#import-the-road-data-into-pgrouting-graph-nodes-and-edges

won't work because in the SHP version of the data the column names are truncated (and uppercase)

ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:'service=lizmap-pgrouting active_schema=bdtopo' -lco DIM=2 -append -lco GEOMETRY_NAME=geom -lco FID=gid -nln bdtopo.troncon_de_route -t_srs EPSG:2154 -nlt PROMOTE_TO_MULTI "TRONCON_DE_ROUTE.shp"

to be more like

ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:'service=lizmap-pgrouting active_schema=bdtopo' -lco DIM=2 -append -lco GEOMETRY_NAME=geom -lco FID=gid -nln bdtopo.troncon_de_route -t_srs EPSG:2154 -nlt PROMOTE_TO_MULTI "YOUR_DOWNLOADED_GPKG.gpkg" troncon_de_route

gioman commented 9 months ago

Indeed, the data is not available because it was project specific (and country specific).

@Gustry understand that, but it is hard to set up a working/testing environment without some sample data, Data that is actually referred in docs without being very clear where to get it.

There is the sample demo : https://demo.lizmap.com/lizmap/index.php/view/map?repository=modules&project=pgrouting

In the "installation" and "configuration" docs pages

https://docs.3liz.org/lizmap-pgrouting-module/installation/

https://docs.3liz.org/lizmap-pgrouting-module/configuration/

I can't see any link to that project. There is a link to a sample project in the sentence "We offer you here a basic project which contains only the layers required and configured for Lizmap." but that returns 404 on 3liz.com but works on github but as stated it is "just" to load/view the already imported data and to be used as template for publishing on LMWC.

This https://demo.lizmap.com/lizmap/index.php/view/media/getMedia?repository=modules&project=pgrouting&path=/media/pgrouting.zip on the other hand is much more useful for a testing setup as it contains the "data.sql" with the inserts (to populate the tables created by installing the module), but there is no mention to this SQL script in docs, just a reference to a sample dataset that is also not linked anywhere. At this point I think you are getting why people gets confused.

Minor detail 1: I also think that "data.sql" should not contain the CREATE SCHEMA pgrouting IF NOT EXISTS; statement, if is assumed that the tables pgrouting.nodes pgrouting.edges are already existing (there are not CREATE TABLE... statements) then the schema "pgrouting" is also already there.

Minor detail 2: It seems your demo here https://demo.lizmap.com/lizmap/index.php/view/map?repository=modules&project=pgrouting is not working, it returns always "No route have been found.".

The data contains only INSERT, because tables are created by the installation process of the module.

See above.

Gustry commented 9 months ago

The 404 link was leading to the directory on GitHub https://github.com/3liz/lizmap-pgrouting-module/tree/master/tests/lizmap/instances/pgrouting With the data in https://github.com/3liz/lizmap-pgrouting-module/tree/master/tests/sql This was IMHO not easy, I have edited the link to the demo website, in 8f997c93aad81299502721accee0a4efdbd46cc5

The ZIP is easier and more info.

Minor detail 1: I also think that "data.sql" should not contain the CREATE SCHEMA pgrouting IF NOT EXISTS;

Fixed https://github.com/3liz/lizmap-web-client-demo/commit/ce115ea934a0aff91ec95d87cb2545dbb2c081f7 I hope during the next export of the data that we won't forget, I didn't check the script.

Minor detail 2: It seems your demo here https://demo.lizmap.com/lizmap/index.php/view/map?repository=modules&project=pgrouting is not working, it returns always "No route have been found.".

Thanks for the feedback, it has been fixed !

gioman commented 9 months ago

Thanks for the replies and patience!