pgRouting / osm2pgrouting

Import tool for OpenStreetMap data to pgRouting database
https://pgrouting.org
GNU General Public License v2.0
286 stars 113 forks source link

Table "ways" has "gid" as id #276

Closed Doev closed 4 years ago

Doev commented 4 years ago

The table "ways" has "gid" as id, but pgrouting set a default to "id". It is not really a problem, but as a beginner you have to find out first.

For example:

select pgr_analyzegraph('ways', 0.000001); -> Fail select pgr_analyzegraph('ways', 0.000001, 'the_geom', 'gid', 'source', 'target', 'true'); -> OK

dkastl commented 4 years ago

gid is frequently used with spatial data in PostgreSQL/PostGIS and so it has been for long time used as default in pgRouting functions and documentation. It's similar to name the geometry colum the_geom and not geom.

id isn't a default term either. Some may name it uid, rid or vid. If you are not happy with the extra function parameters, you can easily create a VIEW of your table to match with the defaults.

Because changing something like this would be confusing for many, probably will break backwards compatibility and just causes extra work with (in my opinion) no real benefit, pgRouting is not planning to change the status quo.

Doev commented 4 years ago

I agree, but the table "ways_vertices_pgr" is using "id" and not "gid" as primary key.