[iRail] Address/coordinates as input HAFAS API

Pieter Colpaert pieter.colpaert at gmail.com
Fri Aug 19 21:58:48 UTC 2011


On Fri, 2011-08-19 at 13:07 +0200, Maarten Hermans wrote:
> Hello all,

Hi Maarten!

> 
> Has someone already succeeded in supplying an address or
> coordinate-pair as input, instead of a station-id?
> 

I haven't.

I wouldn't however solve your problem by connecting to HAFAS. Why don't
you write a script which makes use of e.g. the google geo API which can
map an address to coordinates? You can download a list of all stations
with their lat long coordinates at http://api.irail.be/stations/?lang=NL
or FR. Afterwards you can just write a script which searches for the
closest distance. This has been done before by teh communitaah already
(see the javascript code behind http://www.irail.be/stations/ in the
"nearby" tab). (I know, this is a do it yourself method but believe me,
it will work better than the HAFAS interface)
  
> Validating an address (close to a train station) works [1], but
> requesting trajectories using that address as input gives an error
> [2]. The same for coordinates (of the train station) [3].
> 

In the iRail API we always do 2 requests: 1 to get the actual HAFAS
station ID by sending the name of the station, and 1 to get the actual
route. So we never add it this way since we never got it to work either.


> In each case the error is:
> 
> <Err code='K9220' text='Nearby to the given address stations could not
> be found.' level='E'/>
> 
> Setting the "distance" and "duration" (for traveling to the station)
> attributes of the Adress element to a high value does not help.
> Choosing only trains or all transportation does not seem to matter.
> 

Nice work though! What are you working on if I may be curious? Any
chance you can help to extend our API with your work?


Pieter


> Thanks,
> 
> Maarten
> 
> [1] http://bit.ly/qk8rlV
> [2] http://bit.ly/rudeEO
> [3] http://bit.ly/psubHb
> _______________________________________________
> iRail mailing list
> iRail at list.irail.be
> http://lists.rootspirit.com/mailman/listinfo/irail

-- 
iRail vzw/asbl
+32 (0) 486/747122




More information about the iRail mailing list