Esri / arcgis-rest-js

compact, modular JavaScript wrappers for the ArcGIS REST API
https://developers.arcgis.com/arcgis-rest-js/
Apache License 2.0
347 stars 119 forks source link

Geocoding - README links to old documentation #1148

Closed vicb closed 5 months ago

vicb commented 5 months ago

Describe the problem

The geocoding services ('geocode()andsuggest()` functions) accept many more parameters than what is available in the current API.

For example there is no way to pass an initial location, a country code, nor the max number of results.

Ref:

Describe the proposed solution

Add all missing parameters.

For geocode the existing interface (interface IGeocodeOptions extends IEndpointOptions) can be augmented with the additional parameters.

For suggest (function suggest(partialText: string, requestOptions?: IEndpointOptions)) there is a need to create a new interface ISuggestOptions extending IEndpointOptions

Alternatives considered

No response

Additional Information

I'm willing to create a PR if you are willing to accept it and release a new version with that. Let me know!

vicb commented 5 months ago

/cc @gavinr-maps

gavinr-maps commented 5 months ago

Hi, thank you for logging this issue!

there is no way to pass an initial location, a country code, nor the max number of results

That is not strictly true. For all requests in ArcGIS REST JS, you can always use the params property to pass in any additional properties that is not covered within ArcGIS REST JS. See IGeocodeOptions: image

So although I don't think we are opposed to defining more of the REST API properties in ArcGIS REST JS, there is a current way to pass anything you need to the REST endpoint.

vicb commented 5 months ago

@gavinr-maps Thanks for the tip!

I was looking at the doc referenced by the README of the geocoding package.

That doc (https://esri.github.io/arcgis-rest-js/api/geocoding/geocode/) only mention the address parameters.

I see several options here:

Happy to help with any of those. Let me know what you think

gavinr-maps commented 5 months ago

@vicb thanks for the response.

I was looking at the doc referenced by the README of the geocoding package.

Thank you for pointing that out - you're correct that those URLs are linking to our old v3 documentation (https://esri.github.io/arcgis-rest-js/api/) instead of the new v4 documentation (https://developers.arcgis.com/arcgis-rest-js/api-reference. If you would like to issue a PR to update that README, we would certainly appreciate that!

Note that the v4 documentation for geocoding is here: https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/geocode/ ... and on that page here is where the link to IGeocodeOptions is: image

Thank you!