pgRouting

Changeset 199

Show
Ignore:
Timestamp:
07/30/08 15:22:35 (4 months ago)
Author:
anton
Message:

Limits and templates fixes for WRS

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/routingservice/trunk/configuration.xml

    r195 r199  
    77         
    88        <providers> 
     9                 
    910                <!--GEOBASE--> 
    1011                <provider name="geobase" title="Geobase"> 
    11                         <description></description> 
     12                        <description>no description</description> 
    1213                        <services> 
    1314                                <service name="closest_edge" title="Closest Edge" enable="true"> 
    14                                         <description></description> 
     15                                        <description>no description</description> 
    1516                                        <connection driver="org.postgresql.Driver"> 
    1617                                                <url>jdbc:postgresql://192.168.20.177:5432/geobase</url> 
     
    4546                                                         
    4647                                <service name="shortest_path" title="Shortest Path" enable="true"> 
    47                                         <description></description> 
     48                                        <description>blabla</description> 
    4849                                        <connection driver="org.postgresql.Driver"> 
    4950                                                <url>jdbc:postgresql://192.168.20.177:5432/geobase</url> 
     
    5152                                                <password></password> 
    5253                                        </connection> 
    53                                         <projection srid="900913"></projection> 
     54                                        <projection srid="900913" units="meter" /> 
     55                                        <limit distance="5000.0" /> 
    5456                                        <sql> 
    5557                                                <query transformProjectionIn="false" transformProjectionOut="false">SELECT gid, AsText(the_geom) AS wkt FROM shootingstar_sp_smart('nrn_bc', $sonStartX$, $sonStartY$, $sonEndX$, $sonEndY$, $saBoxSize$,'length',true,true)</query> 
     
    6769                                        </parameters> 
    6870                                        <formats> 
    69                                                 <format name="gml" input="true" output="true" /> 
    70                                                 <format name="xml" input="false" output="true" /> 
    71                                                 <format name="html" input="false" output="true" /> 
    72                                                 <format name="geojson" input="true" output="true" />
    73                                                 <format name="lonlat" input="true" output="false" /> 
    74                                                 <format name="wkt" input="true" output="true" /> 
    75                                                 <format name="kml" input="true" output="true" srid="4326" /> 
     71                                                <format name="gml" input="true" output="true" template="multilinestring_gml" /> 
     72                                                <format name="xml" input="false" output="true" template="multilinestring_xml" /> 
     73                                                <format name="html" input="false" output="true" template="multilinestring_html" /> 
     74                                                <format name="geojson" input="true" output="true" template="multilinestring_geojson" /
     75                                                <format name="lonlat" input="true" output="false" /> 
     76                                                <format name="wkt" input="true" output="true" template="multilinestring_wkt" /> 
     77                                                <format name="kml" input="true" output="true" srid="4326" template="multilinestring_kml" /> 
    7678                                        </formats> 
    7779                                </service> 
    7880                                 
    7981                                <service name="driving_distance" title="Driving Distance" enable="true"> 
    80                                         <description></description> 
     82                                        <description>blabla</description> 
    8183                                        <connection driver="org.postgresql.Driver"> 
    8284                                                <url>jdbc:postgresql://192.168.20.177:5432/geobase</url> 
     
    9496                                                <parameter name="point" type="text" codename="data" required="true" /> 
    9597                                                <parameter name="time" type="integer" codename="time" required="false" /> 
    96                                                 <parameter name="length" type="integer" codename="distance" required="false" /> 
     98                                                <parameter name="length" type="integer" codename="length" required="false" /> 
    9799                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
    98100                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     
    113115                                 
    114116                                <service name="traveling_sales_person" title="Traveling Sales Person" enable="true"> 
    115                                         <description></description> 
     117                                        <description>blabla</description> 
    116118                                        <connection driver="org.postgresql.Driver"> 
    117119                                                <url>jdbc:postgresql://192.168.20.177:5432/geobase</url> 
     
    152154                <!--IPC--> 
    153155                <provider name="ipc" title="IPC"> 
    154                         <description></description> 
     156                        <description>blabla</description> 
    155157                        <services> 
    156158                                <service name="closest_edge" title="Closest Edge" enable="true"> 
     
    188190                                 
    189191                                <service name="shortest_path" title="Shortest Path" enable="true"> 
    190                                         <description></description> 
     192                                        <description>blabla</description> 
    191193                                        <connection driver="org.postgresql.Driver"> 
    192194                                                <url>jdbc:postgresql://192.168.20.177:5432/ipc</url> 
     
    222224                                 
    223225                                <service name="driving_distance" title="Driving Distance" enable="true"> 
    224                                         <description></description> 
     226                                        <description>blabla</description> 
    225227                                        <connection driver="org.postgresql.Driver"> 
    226228                                                <url>jdbc:postgresql://192.168.20.177:5432/ipc</url> 
     
    238240                                                <parameter name="point" type="text" codename="data" required="true" /> 
    239241                                                <parameter name="time" type="integer" codename="time" required="false" /> 
    240                                                 <parameter name="length" type="integer" codename="distance" required="false" /> 
     242                                                <parameter name="length" type="integer" codename="length" required="false" /> 
    241243                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
    242244                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     
    279281                 
    280282                 
    281                 <!--SUUCHI--> 
     283                               <!--SUUCHI--> 
    282284                <provider name="suuchi" title="Suuchi"> 
    283                         <description></description> 
     285                        <description>no description</description> 
    284286                        <services> 
    285287                                <service name="closest_edge" title="Closest Edge" enable="true"> 
     
    317319                                                         
    318320                                <service name="shortest_path" title="Shortest Path" enable="true"> 
    319                                         <description></description> 
     321                                        <description>blabla</description> 
    320322                                        <connection driver="org.postgresql.Driver"> 
    321323                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     
    323325                                                <password></password> 
    324326                                        </connection> 
    325                                         <projection srid="54004"></projection> 
     327                                        <projection srid="4612"></projection> 
    326328                                        <sql> 
    327329                                                <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> 
     
    350352                                 
    351353                                <service name="driving_distance" title="Driving Distance" enable="true"> 
    352                                         <description></description> 
     354                                        <description>blabla</description> 
    353355                                        <connection driver="org.postgresql.Driver"> 
    354356                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     
    366368                                                <parameter name="point" type="text" codename="data" required="true" /> 
    367369                                                <parameter name="time" type="integer" codename="time" required="false" /> 
    368                                                 <parameter name="length" type="integer" codename="distance" required="false" /> 
     370                                                <parameter name="length" type="integer" codename="length" required="false" /> 
    369371                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
    370372                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     
    388390                <!--PGROUTING--> 
    389391                <provider name="pgrouting" title="pgRouting"> 
    390                         <description></description> 
     392                        <description>no description</description> 
    391393                        <services> 
    392394                                <service name="closest_edge" title="Closest Edge" enable="true"> 
     
    424426                                                         
    425427                                <service name="shortest_path" title="Shortest Path" enable="true"> 
    426                                         <description></description> 
     428                                        <description>blabla</description> 
    427429                                        <connection driver="org.postgresql.Driver"> 
    428430                                                <url>jdbc:postgresql://192.168.20.177:5432/pgrouting</url> 
     
    457459                                 
    458460                                <service name="driving_distance" title="Driving Distance" enable="true"> 
    459                                         <description></description> 
     461                                        <description>blabla</description> 
    460462                                        <connection driver="org.postgresql.Driver"> 
    461463                                                <url>jdbc:postgresql://192.168.20.177:5432/pgrouting</url> 
     
    473475                                                <parameter name="point" type="text" codename="data" required="true" /> 
    474476                                                <parameter name="time" type="integer" codename="time" required="false" /> 
    475                                                 <parameter name="length" type="integer" codename="distance" required="false" /> 
     477                                                <parameter name="length" type="integer" codename="length" required="false" /> 
    476478                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
    477479                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     
    496498                <!--HCC--> 
    497499                <provider name="hcc" title="hcc"> 
    498                         <description></description> 
     500                        <description>no description</description> 
    499501                        <services> 
    500502                                <service name="closest_edge" title="Closest Edge" enable="true"> 
    501                                         <description>></description> 
     503                                        <description>>no description</description> 
    502504                                        <connection driver="org.postgresql.Driver"> 
    503505                                                <url>jdbc:postgresql://192.168.20.177:5432/hcc</url> 
     
    532534                                                         
    533535                                <service name="shortest_path" title="Shortest Path" enable="true"> 
    534                                         <description></description> 
     536                                        <description>blabla</description> 
    535537                                        <connection driver="org.postgresql.Driver"> 
    536538                                                <url>jdbc:postgresql://192.168.20.177:5432/hcc</url> 
     
    565567                                 
    566568                                <service name="driving_distance" title="Driving Distance" enable="true"> 
    567                                         <description></description> 
     569                                        <description>blabla</description> 
    568570                                        <connection driver="org.postgresql.Driver"> 
    569571                                                <url>jdbc:postgresql://192.168.20.177:5432/hcc</url> 
     
    581583                                                <parameter name="point" type="text" codename="data" required="true" /> 
    582584                                                <parameter name="time" type="integer" codename="time" required="false" /> 
    583                                                 <parameter name="length" type="integer" codename="distance" required="false" /> 
     585                                                <parameter name="length" type="integer" codename="length" required="false" /> 
    584586                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
    585587                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
     
    600602                        </services> 
    601603                </provider>                                                 
    602                                  
     604                 
     605                 
    603606                <!--SUUCHI2--> 
    604607                <provider name="suuchi2" title="Suuchi2"> 
    605                         <description></description> 
     608                        <description>no description</description> 
    606609                        <services> 
    607610                                <service name="closest_edge" title="Closest Edge" enable="true"> 
    608                                         <description></description> 
     611                                        <description>>no description</description> 
    609612                                        <connection driver="org.postgresql.Driver"> 
    610613                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     
    639642                                                         
    640643                                <service name="shortest_path" title="Shortest Path" enable="true"> 
    641                                         <description></description> 
     644                                        <description>blabla</description> 
    642645                                        <connection driver="org.postgresql.Driver"> 
    643646                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     
    672675                                 
    673676                                <service name="driving_distance" title="Driving Distance" enable="true"> 
    674                                         <description></description> 
     677                                        <description>blabla</description> 
    675678                                        <connection driver="org.postgresql.Driver"> 
    676679                                                <url>jdbc:postgresql://192.168.20.177:5432/suuchi</url> 
     
    688691                                                <parameter name="point" type="text" codename="data" required="true" /> 
    689692                                                <parameter name="time" type="integer" codename="time" required="false" /> 
    690                                                 <parameter name="length" type="integer" codename="distance" required="false" /> 
     693                                                <parameter name="length" type="integer" codename="length" required="false" /> 
    691694                                                <parameter name="speed" type="integer" codename="speed" required="false" default="80" /> 
    692695                                                <parameter name="sridInput" type="integer" codename="sridIn" required="false" /> 
  • tools/routingservice/trunk/configuration.xsd

    r195 r199  
    111111    <xs:attribute name="output" type="xs:boolean"/> 
    112112    <xs:attribute name="srid" type="xs:integer"/> 
     113    <xs:attribute name="template" type="xs:string"/> 
    113114  </xs:complexType> 
    114115</xs:element> 
  • tools/routingservice/trunk/src/jp/co/orkney/restlet/geo/ShortestPath.java

    r172 r199  
    5959 
    6060    /** 
    61      * Constructor ShortestPath 
    62      * <p> 
    63      * Creates a new ShortestPath object using the specified Configuration 
    64      * object and extracts X and Y from the data provides by GET or POST 
    65      * request into a new point (for start and end point). 
    66      * </p> 
    67      *  
    68      * @param configuration 
    69      *                the current configuration 
    70      */ 
     61         * Constructor ShortestPath 
     62         * <p> 
     63         * Creates a new ShortestPath object using the specified Configuration 
     64         * object and extracts X and Y from the data provides by GET or POST 
     65         * request into a new point (for start and end point). 
     66         * </p> 
     67         *  
     68         * @param configuration 
     69         *                the current configuration 
     70         */ 
    7171    public ShortestPath(Configuration configuration, 
    7272            DatabaseConnection databaseConnection, IOHelper ioHelper, Log log) 
     
    119119 
    120120    /** 
    121      * Gets the result of the shortest path algorithm 
    122      *  
    123      * @return this shortest path's result 
    124      */ 
     121         * Gets the result of the shortest path algorithm 
     122         *  
     123         * @return this shortest path's result 
     124         */ 
    125125    public String get() 
    126126    { 
     
    129129 
    130130    /** 
    131      * Starts the "shortest path" algorithm 
    132      *  
    133      * @throws SQLException 
    134      *                 error to send the query to the database 
    135      * @throws JSONException 
    136      *                 Error to transform the result in Geojson format 
    137      */ 
     131         * Starts the "shortest path" algorithm 
     132         *  
     133         * @throws SQLException 
     134         *                 error to send the query to the database 
     135         * @throws JSONException 
     136         *                 Error to transform the result in Geojson format 
     137         */ 
    138138    public void start() throws SQLException, JSONException 
    139139    { 
     
    144144                .getParameter("bbox").getValue()); 
    145145 
    146         if (LimitsHelper.isDistanceAllowed(startPoint, endPoint, configuration 
     146        // We need to define the input projection and reproject the data. 
     147        // This place is not beautiful yet and needs to be reconsidered. 
     148        Point sPoint = startPoint; 
     149        Point ePoint = endPoint; 
     150 
     151        if (configuration.getService().getParameter("sridInput").getValue() != null) 
     152        { 
     153            sPoint = databaseConnection.transform(configuration.getService(), 
     154                    startPoint, configuration.getService().getParameter( 
     155                            "sridInput").getValue(), configuration.getService() 
     156                            .getDataProjection()); 
     157            ePoint = databaseConnection.transform(configuration.getService(), 
     158                    endPoint, configuration.getService().getParameter( 
     159                            "sridInput").getValue(), configuration.getService() 
     160                            .getDataProjection()); 
     161        } 
     162 
     163        if (LimitsHelper.isDistanceAllowed(sPoint, ePoint, configuration 
    147164                .getService().getLimit().getDistance())) 
    148165        { 
     
    166183                    .toString()); 
    167184 
    168         } else 
     185        } 
     186        else 
    169187        { 
    170188            this.log.write("Distance exceedes limits", 1); 
     189            //There should be an exception in this case 
     190            return; 
    171191        } 
    172192 
    173193        String reqId = configuration.getService().getParameter("request_id") 
    174194                .getValue(); 
    175          
    176         StringTemplate template = this.configuration.getFormatOut().getTemplate(); 
    177          
    178         result = this.ioHelper.fillMultilinestringTemplate(rs, this.configuration.getFormatOut().getName(), 
    179                 template, reqId); 
    180          
     195 
     196        StringTemplate template = this.configuration.getFormatOut() 
     197                .getTemplate(); 
     198 
     199        result = this.ioHelper.fillMultilinestringTemplate(rs, 
     200                this.configuration.getFormatOut().getName(), template, reqId); 
     201 
    181202        /* 
    182          
    183         // Converts the SQL Result in Geojson 
    184         if (this.configuration.getFormatOut().getName().equals("geojson")) 
    185         { 
    186             result = this.ioHelper.shortestPathGEOJSONResult(rs, reqId); 
    187         } 
    188         // Converts the SQL Result in HTML 
    189         else if (this.configuration.getFormatOut().getName().equals("html")) 
    190         { 
    191             result = this.ioHelper.shortestPathHTMLResult(rs, startPoint, 
    192                     endPoint, reqId); 
    193         } 
    194         // Converts the SQL Result in XML 
    195         else if (this.configuration.getFormatOut().getName().equals("xml")) 
    196         { 
    197             result = this.ioHelper.shortestPathXMLResult(rs, reqId); 
    198         } 
    199         // Converts the SQL Result in GML 
    200         else if (this.configuration.getFormatOut().getName().equals("gml")) 
    201         { 
    202             result = this.ioHelper.shortestPathGMLResult(rs, reqId); 
    203         } 
    204         // Converts the SQL Result in WKT 
    205         else if (this.configuration.getFormatOut().getName().equals("wkt")) 
    206         { 
    207             result = this.ioHelper.shortestPathWKTResult(rs); 
    208         } 
    209         // Converts the SQL Result in KML 
    210         else if (this.configuration.getFormatOut().getName().equals("kml")) 
    211         { 
    212             result = this.ioHelper.shortestPathKMLResult(rs); 
    213         } 
    214         */ 
     203         *  // Converts the SQL Result in Geojson if 
     204         * (this.configuration.getFormatOut().getName().equals("geojson")) { 
     205         * result = this.ioHelper.shortestPathGEOJSONResult(rs, reqId); } // 
     206         * Converts the SQL Result in HTML else if 
     207         * (this.configuration.getFormatOut().getName().equals("html")) { result = 
     208         * this.ioHelper.shortestPathHTMLResult(rs, startPoint, endPoint, 
     209         * reqId); } // Converts the SQL Result in XML else if 
     210         * (this.configuration.getFormatOut().getName().equals("xml")) { result = 
     211         * this.ioHelper.shortestPathXMLResult(rs, reqId); } // Converts the SQL 
     212         * Result in GML else if 
     213         * (this.configuration.getFormatOut().getName().equals("gml")) { result = 
     214         * this.ioHelper.shortestPathGMLResult(rs, reqId); } // Converts the SQL 
     215         * Result in WKT else if 
     216         * (this.configuration.getFormatOut().getName().equals("wkt")) { result = 
     217         * this.ioHelper.shortestPathWKTResult(rs); } // Converts the SQL Result 
     218         * in KML else if 
     219         * (this.configuration.getFormatOut().getName().equals("kml")) { result = 
     220         * this.ioHelper.shortestPathKMLResult(rs); } 
     221         */ 
    215222 
    216223    } 
  • tools/routingservice/trunk/src/jp/co/orkney/restlet/util/DatabaseConnection.java

    r164 r199  
    11package jp.co.orkney.restlet.util; 
    2  
    32 
    43/** 
     
    1918 */ 
    2019 
    21  
    2220import java.io.File; 
     21import java.math.BigDecimal; 
    2322import java.sql.Connection; 
    2423import java.sql.ResultSet; 
     
    6564public class DatabaseConnection 
    6665{ 
    67         private IOHelper ioHelper; 
    68         private Log log; 
    69         private DatabaseConfiguration databaseConfiguration; 
    70         private Configuration configuration; 
     66    private IOHelper ioHelper; 
    7167 
    72         /** 
    73          * Constructor DatabaseConnection 
    74          * <p> 
    75          * Creates a new DatabaseConnection object with the specified Configuration 
    76          * object 
    77          * </p> 
    78          *  
    79          * @param configuration 
    80          *            The current WebRouting Service's configuration 
    81          */ 
    82         public DatabaseConnection(Configuration configuration) 
     68    private Log log; 
     69 
     70    private DatabaseConfiguration databaseConfiguration; 
     71 
     72    private Configuration configuration; 
     73 
     74    /** 
     75         * Constructor DatabaseConnection 
     76         * <p> 
     77         * Creates a new DatabaseConnection object with the specified 
     78         * Configuration object 
     79         * </p> 
     80         *  
     81         * @param configuration 
     82         *                The current WebRouting Service's configuration 
     83         */ 
     84    public DatabaseConnection(Configuration configuration) 
     85    { 
     86        this.configuration = configuration; 
     87        log = configuration.createLog(); 
     88        // databaseConfiguration = 
     89        // configuration.getService().getDatabaseConfiguration(); 
     90        ioHelper = new IOHelper(configuration); 
     91    } 
     92 
     93    /** 
     94         * Creates and sends the query using pool connection 
     95         *  
     96         * @param query 
     97         *                theSQL query 
     98         * @return the result of the request 
     99         */ 
     100    public ResultSet getResult(Service service, String query) 
     101    { 
     102        StringTemplate queryTemplate = new StringTemplate(ioHelper 
     103                .loadFile(new File(configuration.getUrlXMLTemplateQuery()))); 
     104 
     105        databaseConfiguration = service.getDatabaseConfiguration(); 
     106 
     107        // Makes the SQL query 
     108        queryTemplate.setAttribute("user", databaseConfiguration.getUser()); 
     109        queryTemplate.setAttribute("password", databaseConfiguration 
     110                .getPassword()); 
     111        queryTemplate.setAttribute("query", query); 
     112 
     113        ResultSet result = null; 
     114 
     115        Client client = new Client(Protocol.JDBC); 
     116        JdbcClientHelper helper = new JdbcClientHelper(client); 
     117        try 
    83118        { 
    84                 this.configuration = configuration; 
    85                 log = configuration.createLog(); 
    86                 //databaseConfiguration = configuration.getService().getDatabaseConfiguration(); 
    87                 ioHelper = new IOHelper(configuration); 
     119            Class.forName(databaseConfiguration.getDriver()); 
    88120        } 
     121        catch (ClassNotFoundException e) 
     122        { 
     123            log.write("--ERROR: Can not find the driver", 0); 
     124        } 
     125        Representation req = new StringRepresentation(queryTemplate.toString() 
     126                .replace("&", "&amp;"), MediaType.TEXT_XML); 
     127        Request request = JdbcClientHelper.create(databaseConfiguration 
     128                .getURL(), req); 
     129        Response response = new Response(request); 
     130        helper.handle(request, response); 
    89131 
     132        WebRowSet rowSet = ((RowSetRepresentation) response.getEntity()) 
     133                .getWebRowSet(); 
     134 
     135        try 
     136        { 
     137            result = rowSet; 
     138        } 
     139        catch (Exception ex) 
     140        { 
     141            log 
     142                    .write( 
     143                            "--ERROR: Can not cast the result from WebRowSet to ResultSet", 
     144                            0); 
     145        } 
     146        return result; 
     147    } 
     148 
     149    public void fillKeysTable(Service service, Hashtable keys) 
     150            throws SQLException 
     151    { 
     152        ResultSet rs = getResult(service, "SELECT client_id, key FROM keys"); 
     153        while (rs != null && rs.next()) 
     154            keys.put(rs.getString("client_id").toUpperCase(), rs 
     155                    .getString("key")); 
     156    } 
     157 
     158    public Point transform(Service service, Point point, String sridIn, String sridOut) 
     159            throws SQLException 
     160    { 
     161        Point res = point; 
     162 
     163        double x = point.getX().doubleValue(); 
     164        double y = point.getY().doubleValue(); 
    90165         
    91         /** 
    92          * Creates and sends the query using pool connection 
    93          * @param query theSQL query 
    94          * @return the result of the request 
    95          */ 
    96         public ResultSet getResult(Service service, String query) 
    97         { 
    98                 StringTemplate queryTemplate = new StringTemplate(ioHelper.loadFile(new File(configuration.getUrlXMLTemplateQuery()))); 
    99                  
    100                 databaseConfiguration = service.getDatabaseConfiguration(); 
     166        String query = "select x(a.g), y(a.g) from (select transform(geometryfromtext('POINT(" 
     167                + x + " " + y + ")', " + sridIn + "), " + sridOut 
     168                + ") as g) as a"; 
     169         
     170        this.log.write(query, 2); 
    101171 
    102                 // Makes the SQL query 
    103                 queryTemplate.setAttribute("user",databaseConfiguration.getUser()); 
    104                 queryTemplate.setAttribute("password", databaseConfiguration.getPassword()); 
    105                 queryTemplate.setAttribute("query", query); 
    106                  
    107                 ResultSet result = null; 
    108                  
    109                 Client client = new Client(Protocol.JDBC); 
    110                 JdbcClientHelper helper = new JdbcClientHelper(client); 
    111                 try 
    112                 { 
    113                         Class.forName(databaseConfiguration.getDriver()); 
    114                 } 
    115                 catch (ClassNotFoundException e) 
    116                 { 
    117                         log.write("--ERROR: Can not find the driver", 0); 
    118                 } 
    119                 Representation req = new StringRepresentation(queryTemplate.toString().replace("&", "&amp;"),MediaType.TEXT_XML) ; 
    120                 Request request = JdbcClientHelper.create(databaseConfiguration.getURL(),req); 
    121                 Response response = new Response(request); 
    122                 helper.handle(request, response); 
    123                          
    124                 WebRowSet rowSet = ((RowSetRepresentation)response.getEntity()).getWebRowSet(); 
    125                  
    126                 try {    
    127                         result = rowSet; 
    128                 } catch (Exception ex) { 
    129                         log.write("--ERROR: Can not cast the result from WebRowSet to ResultSet", 0); 
    130                 }                
    131                 return result; 
    132         } 
    133          
    134         public void fillKeysTable(Service service, Hashtable keys) throws SQLException 
    135         { 
    136                 ResultSet rs = getResult(service, "SELECT client_id, key FROM keys"); 
    137                 while (rs != null && rs.next()) 
    138                         keys.put(rs.getString("client_id").toUpperCase(), rs.getString("key")); 
    139         }        
     172        ResultSet rs = getResult(service, query); 
     173 
     174        while (rs != null && rs.next()) 
     175            res = new Point(BigDecimal.valueOf(rs.getDouble("x")), 
     176                    BigDecimal.valueOf(rs.getDouble("y"))); 
     177 
     178        return res; 
     179    } 
    140180} 
  • tools/routingservice/trunk/src/jp/co/orkney/restlet/WebRouting.java

    r167 r199  
    267267                                                                result = action.getResult(); 
    268268                                                                //log.write(action.getResult() + " finished", 1); 
    269  
     269                                                                 
     270                                                                if(result=="") 
     271                                                                { 
     272                                                                    response.setStatus(Status.CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE); 
     273                                                                    error = true; 
     274                                                                } 
    270275                                                                // OUTPUT FORMAT --> 
    271276                                                                if (configuration.getFormatOut().getName().equals("html")) 
  • tools/routingservice/trunk/templates/multilinestring_kml.st

    r171 r199  
     1<?xml version=1.0 encoding=UTF-8?> 
    12<kml> 
    23        <Document>