GIScience / openrouteservice-app-legacy

OpenRouteService is an online route planning application that is based on open source software, open data and open standards.
MIT License
55 stars 36 forks source link

[ORS WIKI/API] Update OpenLS Interface description and direct GET URL API query #165

Closed riccardoklinger closed 9 years ago

riccardoklinger commented 9 years ago

Hi guys,

first: great work!

I am in contact with Enrico Steiger about building a QGIS plugin with ORS. As a cornerstone I am using the descriptions in the OSM wiki: It is stated you can get a xml response (like those from the routing API) by simply curl the following site and/or alter it for the desired address. http://openls.geog.uni-heidelberg.de/testing2015/geocode?FreeFormAdress=Heidelberg,%20Berliner%20Strasse&MaxResponse=20

Unfortunately this isn't working. I have build a workaround and creating now a request and analyze the response like described here: http://openls.geog.uni-heidelberg.de/testing2015/geocoding&help

Can you alter the description in the wiki or open up the API?

ghost commented 9 years ago

Hey Riccardo, thanks for pointing this out, I will update the ORS wiki asap. However since we added lots of new route profiles and additonal parameters I would suggest to always use our RESTful Web OpenLS Services. A latest request schema can be found here: https://github.com/GIScience/openrouteservice/blob/bugfixes-2.2/html/tc_rs.html

Alternatively you can also use a Browser debugging tool (e.g.Firebug) to test OpenLS queries and responses within openrouteservice.org

riccardoklinger commented 9 years ago

Hi Enrico ,,

ATM I am making a direct call against http://openls.geog.uni-heidelberg.de/testing2015/geocoding with a designed request document/xls:

url = "http://openls.geog.uni-heidelberg.de/testing2015/geocoding"
text='<?xml version="1.0" encoding="UTF-8"?><xls:XLS xmlns:xls="http://www.opengis.net/xls" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" version="1.1"><xls:RequestHeader/><xls:Request methodName="GeocodeRequest" requestID="123456789" version="1.1"><xls:GeocodeRequest><xls:Address countryCode="DE"><xls:freeFormAddress>' + start_address + '</xls:freeFormAddress></xls:Address></xls:GeocodeRequest></xls:Request></xls:XLS>'
req = urllib2.Request(url=url, 
    data=text, 
    headers={'Content-Type': 'application/xml'})
response_start=urllib2.urlopen(req).read()
#tidy up response
response_start=urllib2.urlopen(req).read()
newstr = response_start.replace("\n", "")
response_start = newstr.replace("  ", "")
xml = ElementTree.fromstring(response_start)
for child in xml[1][0]:
    numberOfHits = child.attrib["numberOfGeocodedAddresses"]
    print numberOfHits

The plugin is located here

ghost commented 9 years ago

has been updated see https://wiki.openstreetmap.org/wiki/OpenRouteService and ORS contact page