agrc / masquerade

Disguise UGRC's Web API endpoints as an Esri locator service.
https://github.com/agrc/masquerade#readme
MIT License
1 stars 0 forks source link

No candidates found issue #172

Open steveoh opened 10 months ago

steveoh commented 10 months ago

Alex @agilvarry from UDOT was integrating masquerade into a web application and notice that if he typed Salt Lake County and hit enter, no candidates were returned.

Generated URL

https://masquerade.ugrc.utah.gov/arcgis/rest/services/UtahLocator/GeocodeServer/findAddressCandidates?Single Line Input=Salt Lake County&maxLocations=6&outFields=*&outSR="latestWkid":3857&f=json

Response

{"candidates":[],"spatialReference":{"latestWkid":3857,"wkid":102100},"status":200}

However, if you wait for the drop down to show Salt Lake County and click it with the mouse or hit the down arrow and enter a different request is generated and the request works as expected.

Generated URL

https://masquerade.ugrc.utah.gov/arcgis/rest/services/UtahLocator/GeocodeServer/findAddressCandidates?Single Line Input=Salt Lake County&magicKey=29-opensgid.boundaries.county_boundaries&maxLocations=6&outFields=*&outSR={"latestWkid":3857,"wkid":102100}&f=json

Response

{"candidates":[{"address":"Salt Lake County","attributes":{"Match_addr":"Salt Lake County","OpenSGID Table":"opensgid.boundaries.county_boundaries","Score":100,"color4":4,"countynbr":"18","entitynbr":"2010181010.00000000","entityyr":"2010.00000000","fips":"35.00000000","fips_str":"49035","globalid":"b31fdc39-6c17-40db-b45c-e0df37a0573f","name":"SALT LAKE","pop_currestimate":1186257,"pop_lastcensus":1185238,"stateplane":"Central","xid":29},"extent":{"xmax":-12418044.1286655,"xmin":-12496743.553381,"ymax":5000822.8618586,"ymin":4926311.93595986},"location":{"x":-12459279.9167366,"y":4963382.96598803},"score":100}],"spatialReference":{"latestWkid":3857,"wkid":102100},"status":200}

Is it required that you click on a matched record? Otherwise typing it in appears to hit the geocoder as it doesn't know what layer to query. Is this the same experience when not using masquerade with the locate widget?

stdavis commented 10 months ago

This does not surprise me. I send the single-line input requests directly to the geocode service unless there's a magic key which is associated with the drop down item. Maybe I should be querying OpenSGID for single-line input requests as well? Currently, single-line input goes to the geocoder, but get candidates (for type-ahead/dropdown) queries OpenSGID.