pgRouting

Changeset 125

Show
Ignore:
Timestamp:
03/07/08 16:07:30 (9 months ago)
Author:
Matthieu
Message:

Added pool connection

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/routingservice/.classpath

    r107 r125  
    1111        <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/org.restlet.jar"/> 
    1212        <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/org.simpleframework.jar"/> 
    13         <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/postgresql-8.2-506.jdbc4.jar"/> 
    1413        <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/com.noelios.restlet.ext.jdbc_3.0.jar"/> 
    1514        <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/commons-pool-1.4.jar"/> 
    1615        <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/commons-dbcp-1.2.2.jar"/> 
     16        <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/postgresql-8.2-506.jdbc4.jar"/> 
    1717        <classpathentry kind="output" path="bin"/> 
    1818</classpath> 
  • branches/routingservice/configuration.xml

    r109 r125  
    160160                                        <projection srid="900913"></projection> 
    161161                                        <sql> 
    162                                                 <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, source, target, AsText(the_geom) AS wkt, distance(the_geom, GeometryFromText('POINT($sonPx$ $sonPy$)',$sridProvider$)) AS dist FROM kanagawa WHERE the_geom &amp;&amp; setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridProvider$) ORDER BY dist LIMIT 1</query>                                      
    163                                                 <query transformProjectionIn="false" transformProjectionOut="true">SELECT gid, source, target, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt, distance(the_geom, GeometryFromText('POINT($sonPx$ $sonPy$)',$sridProvider$)) AS dist FROM kanagawa WHERE the_geom &amp;&amp; setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridProvider$) ORDER BY dist LIMIT 1</query> 
    164                                                 <query transformProjectionIn="true" transformProjectionOut="false">SELECT gid, source, target, AsText(the_geom) AS wkt, distance(the_geom, transform(GeometryFromText('POINT($sonPx$ $sonPy$)',$sridIn$),$sridProvider$)) AS dist FROM kanagawa WHERE the_geom &amp;&amp; transform(setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridIn$), $sridProvider$) ORDER BY dist LIMIT 1</query> 
    165                                                 <query transformProjectionIn="true" transformProjectionOut="true">SELECT gid, source, target, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt, distance(the_geom, transform(GeometryFromText('POINT($sonPx$ $sonPy$)',$sridIn$),$sridProvider$)) AS dist FROM kanagawa WHERE the_geom &amp;&amp; transform(setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridIn$), $sridProvider$) ORDER BY dist LIMIT 1</query> 
     162                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, source, target, AsText(the_geom) AS wkt, distance(the_geom, GeometryFromText('POINT($sonPx$ $sonPy$)',$sridProvider$)) AS dist FROM ipc_trn WHERE the_geom &amp;&amp; setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridProvider$) ORDER BY dist LIMIT 1</query>                                       
     163                                                <query transformProjectionIn="false" transformProjectionOut="true">SELECT gid, source, target, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt, distance(the_geom, GeometryFromText('POINT($sonPx$ $sonPy$)',$sridProvider$)) AS dist FROM ipc_trn WHERE the_geom &amp;&amp; setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridProvider$) ORDER BY dist LIMIT 1</query> 
     164                                                <query transformProjectionIn="true" transformProjectionOut="false">SELECT gid, source, target, AsText(the_geom) AS wkt, distance(the_geom, transform(GeometryFromText('POINT($sonPx$ $sonPy$)',$sridIn$),$sridProvider$)) AS dist FROM ipc_trn WHERE the_geom &amp;&amp; transform(setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridIn$), $sridProvider$) ORDER BY dist LIMIT 1</query> 
     165                                                <query transformProjectionIn="true" transformProjectionOut="true">SELECT gid, source, target, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt, distance(the_geom, transform(GeometryFromText('POINT($sonPx$ $sonPy$)',$sridIn$),$sridProvider$)) AS dist FROM ipc_trn WHERE the_geom &amp;&amp; transform(setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridIn$), $sridProvider$) ORDER BY dist LIMIT 1</query> 
    166166                                        </sql> 
    167167                                        <parameters> 
     
    192192                                        <projection srid="900913"></projection> 
    193193                                        <sql> 
    194                                                 <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('kanagawa', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
    195                                                 <query transformProjectionIn="false" transformProjectionOut="true">SELECT gid, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM shootingstar_sp_smart('kanagawa', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
    196                                                 <query transformProjectionIn="true" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('kanagawa', X(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), X(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), $saBoxSize$,'length',true,true)</query> 
    197                                                 <query transformProjectionIn="true" transformProjectionOut="true">SELECT gid, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM shootingstar_sp_smart('kanagawa', X(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), X(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), $saBoxSize$,'length',true,true)</query> 
     194                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('ipc_trn', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
     195                                                <query transformProjectionIn="false" transformProjectionOut="true">SELECT gid, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM shootingstar_sp_smart('ipc_trn', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
     196                                                <query transformProjectionIn="true" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('ipc_trn', X(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), X(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), $saBoxSize$,'length',true,true)</query> 
     197                                                <query transformProjectionIn="true" transformProjectionOut="true">SELECT gid, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM shootingstar_sp_smart('ipc_trn', X(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), X(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), $saBoxSize$,'length',true,true)</query> 
    198198                                        </sql> 
    199199                                        <parameters> 
     
    225225                                        <projection srid="900913"></projection> 
    226226                                        <sql> 
    227                                                 <query transformProjectionIn="false" transformProjectionOut="false">SELECT AsText(the_geom) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM kanagawa'''',(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''kanagawa'''')),$distance$,false,false) a, kanagawa b WHERE a.vertex_id = b.source');</query> 
    228                                                 <query transformProjectionIn="false" transformProjectionOut="true">SELECT AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM kanagawa'''',(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''kanagawa'''')),$distance$,false,false) a, kanagawa b WHERE a.vertex_id = b.source');</query> 
    229                                                 <query transformProjectionIn="true" transformProjectionOut="false">SELECT AsText(the_geom) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM kanagawa'''',(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$),$bbox$,''''kanagawa'''')),$distance$,false,false) a, kanagawa b WHERE a.vertex_id = b.source');</query> 
    230                                                 <query transformProjectionIn="true" transformProjectionOut="true">SELECT AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM kanagawa'''',(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$),$bbox$,''''kanagawa'''')),$distance$,false,false) a, kanagawa b WHERE a.vertex_id = b.source');</query> 
     227                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT AsText(the_geom) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM ipc_trn'''',(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''ipc_trn'''')),$distance$,false,false) a, ipc_trn b WHERE a.vertex_id = b.source');</query> 
     228                                                <query transformProjectionIn="false" transformProjectionOut="true">SELECT AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM ipc_trn'''',(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''ipc_trn'''')),$distance$,false,false) a, ipc_trn b WHERE a.vertex_id = b.source');</query> 
     229                                                <query transformProjectionIn="true" transformProjectionOut="false">SELECT AsText(the_geom) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM ipc_trn'''',(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$),$bbox$,''''ipc_trn'''')),$distance$,false,false) a, ipc_trn b WHERE a.vertex_id = b.source');</query> 
     230                                                <query transformProjectionIn="true" transformProjectionOut="true">SELECT AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM ipc_trn'''',(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$),$bbox$,''''ipc_trn'''')),$distance$,false,false) a, ipc_trn b WHERE a.vertex_id = b.source');</query> 
    231231                                        </sql> 
    232232                                        <parameters> 
     
    253253                 
    254254                 
    255                  
    256                 <!--SUUCHI--> 
     255                                <!--SUUCHI--> 
    257256                <provider name="suuchi" title="Suuchi"> 
    258257                        <description>no description</description> 
     
    565564                                </service> 
    566565                        </services> 
     566                </provider>                                                 
     567                 
     568                 
     569                <!--SUUCHI2--> 
     570                <provider name="suuchi2" title="Suuchi2"> 
     571                        <description>no description</description> 
     572                        <services> 
     573                                <service name="closest_edge" title="Closest Edge" enable="true"> 
     574                                        <description>>no description</description> 
     575                                        <connection driver="org.postgresql.Driver"> 
     576                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     577                                                <user>postgres</user> 
     578                                                <password></password> 
     579                                        </connection> 
     580                                        <projection srid="4612"></projection> 
     581                                        <sql> 
     582                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, source, target, AsText(the_geom) AS wkt, distance(the_geom, GeometryFromText('POINT($sonPx$ $sonPy$)',$sridProvider$)) AS dist FROM tohoku_chihou WHERE the_geom &amp;&amp; setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridProvider$) ORDER BY dist LIMIT 1</query>                                   
     583                                                <query transformProjectionIn="false" transformProjectionOut="true">SELECT gid, source, target, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt, distance(the_geom, GeometryFromText('POINT($sonPx$ $sonPy$)',$sridProvider$)) AS dist FROM tohoku_chihou WHERE the_geom &amp;&amp; setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridProvider$) ORDER BY dist LIMIT 1</query> 
     584                                                <query transformProjectionIn="true" transformProjectionOut="false">SELECT gid, source, target, AsText(the_geom) AS wkt, distance(the_geom, transform(GeometryFromText('POINT($sonPx$ $sonPy$)',$sridIn$),$sridProvider$)) AS dist FROM tohoku_chihou WHERE the_geom &amp;&amp; transform(setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridIn$), $sridProvider$) ORDER BY dist LIMIT 1</query> 
     585                                                <query transformProjectionIn="true" transformProjectionOut="true">SELECT gid, source, target, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt, distance(the_geom, transform(GeometryFromText('POINT($sonPx$ $sonPy$)',$sridIn$),$sridProvider$)) AS dist FROM tohoku_chihou WHERE the_geom &amp;&amp; transform(setsrid('BOX3D($sonPxM$ $sonPyM$,$sonPxP$ $sonPyP$)'::box3d, $sridIn$), $sridProvider$) ORDER BY dist LIMIT 1</query> 
     586                                        </sql> 
     587                                        <parameters> 
     588                                                <parameter name="point" type="text" codename="data" required="true" /> 
     589                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     590                                                <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 
     591                                                <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.011" /> 
     592                                        </parameters> 
     593                                        <formats> 
     594                                                <format name="gml" input="true" output="true" /> 
     595                                                <format name="xml" input="false" output="true" /> 
     596                                                <format name="html" input="false" output="true" /> 
     597                                                <format name="geojson" input="true" output="true" /> 
     598                                                <format name="id" input="false" output="true" /> 
     599                                                <format name="lonlat" input="true" output="false" /> 
     600                                                <format name="wkt" input="true" output="true" /> 
     601                                                <format name="kml" input="true" output="true" srid="4326" /> 
     602                                        </formats> 
     603                                </service> 
     604                                                         
     605                                <service name="shortest_path" title="Shortest Path" enable="true"> 
     606                                        <description>blabla</description> 
     607                                        <connection driver="org.postgresql.Driver"> 
     608                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     609                                                <user>postgres</user> 
     610                                                <password></password> 
     611                                        </connection> 
     612                                        <projection srid="4612"></projection> 
     613                                        <sql> 
     614                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('tohoku_chihou', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
     615                                                <query transformProjectionIn="false" transformProjectionOut="true">SELECT gid, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM shootingstar_sp_smart('tohoku_chihou', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
     616                                                <query transformProjectionIn="true" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('tohoku_chihou', X(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), X(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), $saBoxSize$,'length',true,true)</query> 
     617                                                <query transformProjectionIn="true" transformProjectionOut="true">SELECT gid, AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM shootingstar_sp_smart('tohoku_chihou', X(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonStartX$ $sonStartY$)',$sridIn$),$sridProvider$)), X(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), Y(transform(GeometryFromText('POINT($sonEndX$ $sonEndY$)',$sridIn$),$sridProvider$)), $saBoxSize$,'length',true,true)</query> 
     618                                        </sql> 
     619                                        <parameters> 
     620                                                <parameter name="point_start" type="text" codename="start" required="true" /> 
     621                                                <parameter name="point_end" type="text" codename="end" required="true" /> 
     622                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     623                                                <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 
     624                                                <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.011" /> 
     625                                        </parameters> 
     626                                        <formats> 
     627                                                <format name="gml" input="true" output="true" /> 
     628                                                <format name="xml" input="false" output="true" /> 
     629                                                <format name="html" input="false" output="true" /> 
     630                                                <format name="geojson" input="true" output="true" />> 
     631                                                <format name="lonlat" input="true" output="false" /> 
     632                                                <format name="wkt" input="true" output="true" /> 
     633                                                <format name="kml" input="true" output="true" srid="4326" /> 
     634                                        </formats> 
     635                                </service> 
     636                                 
     637                                <service name="driving_distance" title="Driving Distance" enable="true"> 
     638                                        <description>blabla</description> 
     639                                        <connection driver="org.postgresql.Driver"> 
     640                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     641                                                <user>postgres</user> 
     642                                                <password></password> 
     643                                        </connection> 
     644                                        <projection srid="4612"></projection> 
     645                                        <sql> 
     646                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT AsText(the_geom) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM tohoku_chihou'''',(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''tohoku_chihou'''')),$distance$,false,false) a, tohoku_chihou b WHERE a.vertex_id = b.source');</query> 
     647                                                <query transformProjectionIn="false" transformProjectionOut="true">SELECT AsText(transform(setsrid(the_geom, $sridProvider$), $sridOut$)) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM tohoku_chihou'''',(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''tohoku_chihou'''')),$distance$,false,false) a, tohoku_chihou b WHERE a.vertex_id = b.source');</query> 
     648                                                <query transformProjectionIn="true" transformProjectionOut="false">SELECT AsText(the_geom) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM tohoku_chihou'''',(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$),$bbox$,''''tohoku_chihou'''')),$distance$,false,false) a, tohoku_chihou b WHERE a.vertex_id = b.source');</query> 
     649                                                <query transformProjectionIn="true" transformProjectionOut="true">SELECT AsText(transform(setSRID(the_geom,$sridProvider$), $sridOut$)) AS wkt FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer,length::double precision AS cost FROM tohoku_chihou'''',(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$),$bbox$,''''tohoku_chihou'''')),$distance$,false,false) a, tohoku_chihou b WHERE a.vertex_id = b.source');</query> 
     650                                        </sql> 
     651                                        <parameters> 
     652                                                <parameter name="point" type="text" codename="data" required="true" /> 
     653                                                <parameter name="time" type="integer" codename="time" required="false" /> 
     654                                                <parameter name="length" type="integer" codename="length" required="false" /> 
     655                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
     656                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     657                                                <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 
     658                                                <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.011" /> 
     659                                        </parameters> 
     660                                        <formats> 
     661                                                <format name="gml" input="true" output="true" /> 
     662                                                <format name="xml" input="false" output="true" /> 
     663                                                <format name="html" input="false" output="true" /> 
     664                                                <format name="geojson" input="true" output="true" />> 
     665                                                <format name="lonlat" input="true" output="false" /> 
     666                                                <format name="wkt" input="true" output="true" /> 
     667                                                <format name="kml" input="true" output="true" srid="4326" /> 
     668                                        </formats> 
     669                                </service> 
     670                        </services> 
    567671                </provider> 
    568672        </providers> 
  • branches/routingservice/src/jp/co/orkney/restlet/geo/ClosestEdge.java

    r115 r125  
    2929import org.antlr.stringtemplate.StringTemplate; 
    3030import org.json.JSONException; 
    31  
    32 import com.noelios.restlet.ext.jdbc.RowSetRepresentation; 
    3331 
    3432/** 
     
    125123         */ 
    126124        public void start() throws SQLException, JSONException 
    127         {       
     125        { 
    128126                databaseConnection = new DatabaseConnection(configuration); 
    129                  
     127 
    130128                StringTemplate query = ioHelper.getQuery(); 
    131129                float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 
     
    141139                query.setAttribute("sridIn", configuration.getService().getParameter("sridInput").getValue()); 
    142140                query.setAttribute("sridOut", configuration.getService().getParameter("sridOutput").getValue()); 
    143                  
    144                 ResultSet rs = databaseConnection.makeRequest(query.toString()); 
    145141 
    146                  
    147                 /*databaseConnection = new DatabaseConnection(configuration); 
    148                 databaseConnection.start(); 
     142                // System.out.println(query.toString()); 
     143                log.write(query.toString(), 1); 
     144                ResultSet rs = databaseConnection.getResult(query.toString()); 
    149145 
    150                 if (databaseConnection.isStart()) 
     146                // Converts the SQL Result in Geojson 
     147                if (configuration.getFormatOut().getName().equals("geojson")) 
    151148                { 
    152                         StringTemplate query = ioHelper.getQuery(); 
    153                         float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 
     149                        result = ioHelper.closestEdgeGEOJSONResult(rs); 
     150                } 
     151                // Converts the SQL Result in HTML 
     152                else if (configuration.getFormatOut().getName().equals("html")) 
     153                { 
     154                        System.out.println("hjhh"); 
     155                        result = ioHelper.closestEdgeHTMLResult(rs, point); 
     156                } 
     157                // Converts the SQL Result in XML 
     158                else if (configuration.getFormatOut().getName().equals("xml")) 
     159                { 
     160                        result = ioHelper.closestEdgeXMLResult(rs); 
     161                } 
     162                // Converts the SQL Result in ID (edge id) 
     163                else if (configuration.getFormatOut().getName().equals("id")) 
     164                { 
     165                        result = ioHelper.closestEdgeIDResult(rs); 
     166                } 
     167                // Converts the SQL Result in GML 
     168                else if (configuration.getFormatOut().getName().equals("gml")) 
     169                { 
     170                        result = ioHelper.closestEdgeGMLResult(rs); 
     171                } 
     172                // Converts the SQL Result in WKT 
     173                else if (configuration.getFormatOut().getName().equals("wkt")) 
     174                { 
     175                        result = ioHelper.closestEdgeWKTResult(rs); 
     176                } 
     177                // Converts the SQL Result in KML 
     178                else if (configuration.getFormatOut().getName().equals("kml")) 
     179                { 
     180                        result = ioHelper.closestEdgeKMLResult(rs); 
     181                } 
    154182 
    155                         // Makes the SQL query 
    156                         query.setAttribute("sonPx", point.getX()); 
    157                         query.setAttribute("sonPy", point.getY()); 
    158                         query.setAttribute("sonPxM", point.getX(-bboxSize)); 
    159                         query.setAttribute("sonPxP", point.getX(bboxSize)); 
    160                         query.setAttribute("sonPyM", point.getY(-bboxSize)); 
    161                         query.setAttribute("sonPyP", point.getY(bboxSize)); 
    162                         query.setAttribute("sridProvider", configuration.getService().getDataProjection()); 
    163                         query.setAttribute("sridIn", configuration.getService().getParameter("sridInput").getValue()); 
    164                         query.setAttribute("sridOut", configuration.getService().getParameter("sridOutput").getValue()); 
    165  
    166                         //System.out.println(query.toString()); 
    167                         log.write(query.toString(),1); 
    168                         ResultSet rs = databaseConnection.getResult(query.toString());*/ 
    169                          
    170                         // Converts the SQL Result in Geojson 
    171                         if (configuration.getFormatOut().getName().equals("geojson")) 
    172                         { 
    173                                 result = ioHelper.closestEdgeGEOJSONResult(rs); 
    174                         } 
    175                         // Converts the SQL Result in HTML 
    176                         else if (configuration.getFormatOut().getName().equals("html")) 
    177                         { 
    178                                 result = ioHelper.closestEdgeHTMLResult(rs, point); 
    179                         } 
    180                         // Converts the SQL Result in XML 
    181                         else if (configuration.getFormatOut().getName().equals("xml")) 
    182                         { 
    183                                 result = ioHelper.closestEdgeXMLResult(rs); 
    184                         } 
    185                         // Converts the SQL Result in ID (edge id) 
    186                         else if (configuration.getFormatOut().getName().equals("id")) 
    187                         { 
    188                                 result = ioHelper.closestEdgeIDResult(rs); 
    189                         } 
    190                         // Converts the SQL Result in GML 
    191                         else if (configuration.getFormatOut().getName().equals("gml")) 
    192                         { 
    193                                 result = ioHelper.closestEdgeGMLResult(rs); 
    194                         } 
    195                         // Converts the SQL Result in WKT 
    196                         else if (configuration.getFormatOut().getName().equals("wkt")) 
    197                         { 
    198                                 result = ioHelper.closestEdgeWKTResult(rs); 
    199                         } 
    200                         // Converts the SQL Result in KML 
    201                         else if (configuration.getFormatOut().getName().equals("kml")) 
    202                         { 
    203                                 result = ioHelper.closestEdgeKMLResult(rs); 
    204                         } 
    205  
    206                         /*databaseConnection.close(); 
    207                 }*/ 
     183                /* 
     184                 * databaseConnection.close(); } 
     185                 */ 
    208186        } 
    209187} 
  • branches/routingservice/src/jp/co/orkney/restlet/geo/DrivingDistance.java

    r107 r125  
    3131 
    3232/** 
    33  * <b>DrivingDistance is a class which represents a "driving distance isoline" algorithm.</b> 
     33 * <b>DrivingDistance is a class which represents a "driving distance isoline" 
     34 * algorithm.</b> 
    3435 * <p> 
    3536 * "driving distance" algorithm follows these steps: 
     
    6263        private float length; 
    6364        private Log log; 
    64          
     65 
    6566        /** 
    6667         * Constructor DrivingDistance 
    6768         * <p> 
    68          * Creates a new DrivingDistance object using the specified Configuration object 
    69          * and extracts X and Y from the data provides by GET or POST request into a 
    70          * new point. 
     69         * Creates a new DrivingDistance object using the specified Configuration 
     70         * object and extracts X and Y from the data provides by GET or POST request 
     71         * into a new point. 
    7172         * </p> 
    7273         *  
     
    105106                        point = ioHelper.extractKMLPxPy(this.configuration.getService().getParameter("point").getValue()); 
    106107                } 
    107                  
    108                 if(this.configuration.getService().getParameter("speed").getValue()!=null) 
     108 
     109                if (this.configuration.getService().getParameter("speed").getValue() != null) 
    109110                { 
    110111                        speed = Float.parseFloat(this.configuration.getService().getParameter("speed").getValue()); 
     
    114115                        speed = 0; 
    115116                } 
    116                  
    117                 if(this.configuration.getService().getParameter("time").getValue()!=null) 
     117 
     118                if (this.configuration.getService().getParameter("time").getValue() != null) 
    118119                { 
    119120                        time = Float.parseFloat(this.configuration.getService().getParameter("time").getValue()); 
     
    123124                        time = 0; 
    124125                } 
    125                  
    126                 if(this.configuration.getService().getParameter("length").getValue()!=null) 
     126 
     127                if (this.configuration.getService().getParameter("length").getValue() != null) 
    127128                { 
    128129                        length = Float.parseFloat(this.configuration.getService().getParameter("length").getValue()); 
     
    133134                } 
    134135        } 
    135          
     136 
    136137        /** 
    137138         * Gets the result of the driving distance algorithm 
     
    143144                return result; 
    144145        } 
    145          
     146 
    146147        /** 
    147148         * Starts the "driving distance" algorithm 
     
    155156        { 
    156157                databaseConnection = new DatabaseConnection(configuration); 
    157                 databaseConnection.start(); 
    158  
    159                 if (databaseConnection.isStart()) 
    160                 { 
    161                         StringTemplate query = ioHelper.getQuery(); 
    162                         float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 
    163                         float distance = 0; 
    164                         //I can not specify both TIME and LENGTH for driving distance algorthims 
    165                         if(time > 0) 
    166                         { 
    167                                 distance = time*speed; 
    168                         } 
    169                         else 
    170                         { 
    171                                 distance = length; 
    172                         } 
    173                         // Makes the SQL query 
    174                         query.setAttribute("sonPx", point.getX()); 
    175                         query.setAttribute("sonPy", point.getY()); 
    176                         query.setAttribute("bbox", bboxSize); 
    177                         query.setAttribute("distance", distance); 
    178                         query.setAttribute("sridProvider", configuration.getService().getDataProjection()); 
    179                         query.setAttribute("sridIn", configuration.getService().getParameter("sridInput").getValue()); 
    180                         query.setAttribute("sridOut", configuration.getService().getParameter("sridOutput").getValue()); 
    181                          
    182                         //System.out.println(query.toString()); 
    183                         log.write(query.toString(),1); 
    184                         ResultSet rs = databaseConnection.getResult(query.toString()); 
    185  
    186                         // Converts the SQL Result in Geojson 
    187                         if (configuration.getFormatOut().getName().equals("geojson")) 
    188                         { 
    189                                 result = ioHelper.drivingDistanceGEOJSONResult(rs); 
    190                         } 
    191                         // Converts the SQL Result in HTML 
    192                         else if (configuration.getFormatOut().getName().equals("html")) 
    193                         { 
    194                                 result = ioHelper.drivingDistanceHTMLResult(rs, point); 
    195                         } 
    196                         // Converts the SQL Result in XML 
    197                         else if (configuration.getFormatOut().getName().equals("xml")) 
    198                         { 
    199                                 result = ioHelper.drivingDistanceXMLResult(rs); 
    200                         } 
    201                         // Converts the SQL Result in GML 
    202                         else if (configuration.getFormatOut().getName().equals("gml")) 
    203                         { 
    204                                 result = ioHelper.drivingDistanceGMLResult(rs); 
    205                         } 
    206                         // Converts the SQL Result in WKT 
    207                         else if (configuration.getFormatOut().getName().equals("wkt")) 
    208                         { 
    209                                 result = ioHelper.drivingDistanceWKTResult(rs); 
    210                         } 
    211                         // Converts the SQL Result in KML 
    212                         else if (configuration.getFormatOut().getName().equals("kml")) 
    213                         { 
    214                                 result = ioHelper.drivingDistanceKMLResult(rs); 
    215                         } 
    216  
    217                         databaseConnection.close(); 
     158 
     159                StringTemplate query = ioHelper.getQuery(); 
     160                float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 
     161                float distance = 0; 
     162                // I can not specify both TIME and LENGTH for driving distance 
     163                // algorithms 
     164                if (time > 0) 
     165                { 
     166                        distance = time * speed; 
     167                } 
     168                else 
     169                { 
     170                        distance = length; 
     171                } 
     172                // Makes the SQL query 
     173                query.setAttribute("sonPx", point.getX()); 
     174                query.setAttribute("sonPy", point.getY()); 
     175                query.setAttribute("bbox", bboxSize); 
     176                query.setAttribute("distance", distance); 
     177                query.setAttribute("sridProvider", configuration.getService().getDataProjection()); 
     178                query.setAttribute("sridIn", configuration.getService().getParameter("sridInput").getValue()); 
     179                query.setAttribute("sridOut", configuration.getService().getParameter("sridOutput").getValue()); 
     180 
     181                // System.out.println(query.toString()); 
     182                log.write(query.toString(), 1); 
     183                ResultSet rs = databaseConnection.getResult(query.toString()); 
     184 
     185                // Converts the SQL Result in Geojson 
     186                if (configuration.getFormatOut().getName().equals("geojson")) 
     187                { 
     188                        result = ioHelper.drivingDistanceGEOJSONResult(rs); 
     189                } 
     190                // Converts the SQL Result in HTML 
     191                else if (configuration.getFormatOut().getName().equals("html")) 
     192                { 
     193                        result = ioHelper.drivingDistanceHTMLResult(rs, point); 
     194                } 
     195                // Converts the SQL Result in XML 
     196                else if (configuration.getFormatOut().getName().equals("xml")) 
     197                { 
     198                        result = ioHelper.drivingDistanceXMLResult(rs); 
     199                } 
     200                // Converts the SQL Result in GML 
     201                else if (configuration.getFormatOut().getName().equals("gml")) 
     202                { 
     203                        result = ioHelper.drivingDistanceGMLResult(rs); 
     204                } 
     205                // Converts the SQL Result in WKT 
     206                else if (configuration.getFormatOut().getName().equals("wkt")) 
     207                { 
     208                        result = ioHelper.drivingDistanceWKTResult(rs); 
     209                } 
     210                // Converts the SQL Result in KML 
     211                else if (configuration.getFormatOut().getName().equals("kml")) 
     212                { 
     213                        result = ioHelper.drivingDistanceKMLResult(rs); 
    218214                } 
    219215        } 
  • branches/routingservice/src/jp/co/orkney/restlet/geo/ShortestPath.java

    r107 r125  
    6464         * Constructor ShortestPath 
    6565         * <p> 
    66          * Creates a new ShortestPath object using the specified Configuration object 
    67          * and extracts X and Y from the data provides by GET or POST request into a 
    68          * new point (for start and end point). 
     66         * Creates a new ShortestPath object using the specified Configuration 
     67         * object and extracts X and Y from the data provides by GET or POST request 
     68         * into a new point (for start and end point). 
    6969         * </p> 
    7070         *  
     
    131131        { 
    132132                databaseConnection = new DatabaseConnection(configuration); 
    133                 databaseConnection.start(); 
    134133 
    135                 if (databaseConnection.isStart()) 
     134                StringTemplate query = ioHelper.getQuery(); 
     135                float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 
     136 
     137                // Makes the SQL query 
     138                query.setAttribute("sonStartX", startPoint.getX()); 
     139                query.setAttribute("sonStartY", startPoint.getY()); 
     140                query.setAttribute("sonEndX", endPoint.getX()); 
     141                query.setAttribute("sonEndY", endPoint.getY()); 
     142                query.setAttribute("saBoxSize", bboxSize); 
     143                query.setAttribute("sridProvider", configuration.getService().getDataProjection()); 
     144                query.setAttribute("sridIn", configuration.getService().getParameter("sridInput").getValue()); 
     145                query.setAttribute("sridOut", configuration.getService().getParameter("sridOutput").getValue()); 
     146 
     147                // System.out.println(query.toString()); 
     148                log.write(query.toString(), 1); 
     149                ResultSet rs = databaseConnection.getResult(query.toString()); 
     150 
     151                // Converts the SQL Result in Geojson 
     152                if (configuration.getFormatOut().getName().equals("geojson")) 
    136153                { 
    137                         StringTemplate query = ioHelper.getQuery(); 
    138                         float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 
    139  
    140                         // Makes the SQL query 
    141                         query.setAttribute("sonStartX", startPoint.getX()); 
    142                         query.setAttribute("sonStartY", startPoint.getY()); 
    143                         query.setAttribute("sonEndX", endPoint.getX()); 
    144                         query.setAttribute("sonEndY", endPoint.getY()); 
    145                         query.setAttribute("saBoxSize", bboxSize); 
    146                         query.setAttribute("sridProvider", configuration.getService().getDataProjection()); 
    147                         query.setAttribute("sridIn", configuration.getService().getParameter("sridInput").getValue()); 
    148                         query.setAttribute("sridOut", configuration.getService().getParameter("sridOutput").getValue()); 
    149  
    150                         //System.out.println(query.toString()); 
    151                         log.write(query.toString(),1); 
    152                         ResultSet rs = databaseConnection.getResult(query.toString()); 
    153  
    154                         // Converts the SQL Result in Geojson 
    155                         if (configuration.getFormatOut().getName().equals("geojson")) 
    156                         { 
    157