[pgrouting-users] question : Shortest Path Shooting star using
python
bino oetomo
bino at indoakses-online.com
Fri Feb 3 00:51:03 EST 2012
Dear Stephen.
I really appreciate your enlightment.
On 02/03/2012 11:58 AM, Stephen Woodbridge wrote:
> 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;
>
When I try to use your query , I got
---Start---
ERROR: syntax error at or near ")"
LINE 7: ) as rt
^
********** Error **********
ERROR: syntax error at or near ")"
SQL state: 42601
Character: 179
--Stop---
Next I try to change it to :
--Start---
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;
---Stop---
and I got :
---Start---
ERROR: missing FROM-clause entry for table "ways"
LINE 8: WHERE ways.gid=rt.gid;
^
********** Error **********
ERROR: missing FROM-clause entry for table "ways"
SQL state: 42P01
Character: 192
---Stop---
ANother try , I change it to :
--Start---
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 gid=rt.gid;
---Stop---
No Error, but the result is '4946.66004129405' , is it in meter ?
If it is in meter, I believe it's wrong result .. since that route is my
daily route.
Sincerely
-bino-
> 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
>
> _______________________________________________
> 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