Interval has incorrect value or format (JS API)


#1

Hey,

I’m trying to fetch isochrones using your Javascript API:

 const geojson = await Isochrones.calculate({
   locations: [[lon, lat]],
   profile: profile,
   range: [900],
   range_type: 'time',
   area_units: 'm',
   units: 'm',
   interval: [300]
 })

As a result I get the following error message:

"error":{"code":3002,"message":"Parameter \'interval\' has incorrect value or format
According to the OrsIsochroneSchema.js, it can be a list of multiple ranges, e.g. [600, 1200, 1400] or a single value list. Neither [300] nor [300, 600, 900] are working.

Can any of you help me out with how to get the different intervals?


#2

interval is not really the right parameter for what you want to do I guess.

Try to ditch interval and only use range with a list of arbitrary values, up to 10.


#3

Hey Nils,

thanks for your reply. I tried it first using the API playground which was working fine. When I implemented it in my application I got this ValidationError: child "range" fails because ["range" must contain less than or equal to 1 items].


#4

Ok I see, it’s this darn validation. It’s a very maintenance-heavy feature of our SDKs, I think we should remove object validation entirely and rely on descriptive backend errors, which has gotten quite good in ORS v2. What’ya think @timothy? Is there a way to turn validation dynamically in ors-js?


#5

Alright, thanks for your reply! Will there be an announcement if anything changes?