pgRouting

Forum #23 - Topic #36 - Message List

Support for geographic spatial references

Are there any plans to support geographic spatial references natively? It appears that assign_vertex_id doesn't care for tolerances between 0 and 1. I guess I can appreciate the complexity of the problem of assigning a degree map unit as a tolerance but I'd really like to store my data as WGS84 and thus far I haven't been able to get pgRouting working with the 4326 srid. It works great for me on projected coordinate systems.

  • Message #131

    I see no reason why assign_vertex_id shouldn't work with degree units.
    I tried it with, for example, NAD83 and 0.0001 degrees of tolerance and it worked perfectly.

    Can you describe your problem? Where assign_vertex_id fails?

    • Message #136

      In the pgAdmin III Query dialog I enter...

      SELECT assign_vertex_id('roadsegments_nwk', 0.0001);

      I receive back...

      ERROR: function assign_vertex_id("unknown", numeric) does not exist SQL state: 42883 Hint: No function matches the given name and argument types. You may need to add explicit type casts. Character: 8

      I've added the necessary x1,y1,x2,y2,source_id, and target_id fields to roadsegments_nwk table and am certain that I'm running the query on the correct database. My roadsegments_nwk table is registered in the geometry_columns table as a 'LINESTRING' with 4326 as its srid.

      I've had issues before on LINESTRING types so maybe it's that? Not quite sure. Thanks in advance for the help!

      • Message #137

        Which version of pgRouting are you using?

        • Message #138

          I'm using 1.0.0.a win32 installer with an updated routing_postgis.sql file from trunk.

          • Message #139

            Ah, I see.

            Updated routing_postgis.sql file contains newer version of the assign_vertex function:

            assign_vertex_id(geom_table varchar, tolerance double precision, geo_cname varchar, gid_cname varchar)

            where geo_cname is your geometry column name and geo_cname (usualy the_geom) is your edge id column name (usualy gid).

            • Message #141

              Anton,

              Thank you. That was my problem.

              • Message #142

                You are welcome!

  • Message #511

    Is there a possibility to convert a table with a geometry column with srid 4326 into a column with srid 54004?

    • Message #512

      Yes, it is possible.
      Create a new geometry column for that with srid 54004, then update this column with the function ST_Transform(<geometry>, 54004). You can drop the old geometry column then to keep it small for routing.

      • Message #519

        Thanks but my spatial_ref_sys table doesn't have an entry for srid 54004