[pgrouting-users] question : Shortest Path Shooting star using python

Stephen Woodbridge woodbri at swoodbridge.com
Thu Feb 2 23:58:43 EST 2012


You do not even need to do the transform if you use:

  select sum(ST_Length2D_Spheroid(the_geom,
             'SPHEROID["GRS_1980",6378137,298.257222101]'))
  FROM shootingstar_sp(
  'ways',
  195690, 11690,
  0.1, 'length', true, true)
  ) as rt
  WHERE ways.gid=rt.gid;

Also, You should be aware that shootingstar_sp() function is broken in 
v1.03 and v1.05.

-Steve

On 2/2/2012 11:47 PM, bino oetomo wrote:
> Dear Daniel and all
> I really appreciate your enlightment
> On 02/03/2012 11:18 AM, Daniel Kastl wrote:
>>
>> The unit is the unit of your projection. It's probably degree in your case.
>>
>>
>
>> You can transform your projection for example to some meter projection like
>> "World Mercator"  (ie. EPSG:3785).
>> Then length(geometry) will be in meter.
>>
>> Like"SELECT length(ST_transform(<geometry column>,3785)) AS meter FROM
>> <table>".
>>
>
> I tried to change the query to :
> ---START----
> SELECT rt.gid, ST_AsGeoJSON(rt.the_geom) AS geojson,
> length(ST_transform(rt.the_geom,3785)) AS length, ways.gid
> FROM "ways",
> (SELECT gid, the_geom
> FROM shootingstar_sp(
> 'ways',
> 195690, 11690,
> 0.1, 'length', true, true)
> ) as rt
> WHERE ways.gid=rt.gid;
> ----STOP----
>
> but I got error, looks like that '3785' is not listed in 'spatial_ref_sys' :
> ---Start---
> Traceback (most recent call last):
> File "routecalc01a.py", line 21, in <module>
> cur.execute(mysqlquery)
> psycopg2.InternalError: AddToPROJ4SRSCache: Cannot find SRID (3785) in
> spatial_ref_sys
> ----stop---
>
> How to add that projection to spatial_ref_sys ?
> Anyway .. my data is for indonesia are, and I want the unit is in meter.
> What projection is the right one ?
>
> Sincerely
> -bino-
>
>
>> Daniel
>>
>>
>>
>>> Note : When I try to count the route using same start Lat/Lon and end
>>> lat/lon, google map said it was about 2.1 km
>>>
>>> Sincerely
>>> -bino-
>>>
>>> ______________________________**_________________
>>> Pgrouting-users mailing list
>>> Pgrouting-users at lists.osgeo.**org  <mailto:Pgrouting-users at lists.osgeo.**org>  <Pgrouting-users at lists.osgeo.org>  <mailto:Pgrouting-users at lists.osgeo.org>
>>> http://lists.osgeo.org/**mailman/listinfo/pgrouting-**users<http://lists.osgeo.org/mailman/listinfo/pgrouting-users>
>>>
>>
>>
>> _______________________________________________
>> Pgrouting-users mailing list
>> Pgrouting-users at lists.osgeo.org  <mailto:Pgrouting-users at lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
>
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users



More information about the Pgrouting-users mailing list