cmv-app icon indicating copy to clipboard operation
cmv-app copied to clipboard

how to change geocoding service from ESRI to mine?

Open JudyZhou opened this issue 8 years ago • 9 comments

I have my own geocoding service. how to change geocoder widget from ESRI's to mine? how to set a configuration? Thanks!

JudyZhou avatar Nov 09 '16 18:11 JudyZhou

This should do it:

            geocoder: {
                include: true,
                type: 'domNode',
                path: 'esri/dijit/Search',
                srcNodeRef: 'searchDijit',
                options: {
                    map: true,
                    mapRightClickMenu: true,
                    enableInfoWindow: true
                    sources: [{
                       placeholder: 'Address, parcelid, place..',
                         locator: new Locator('arcgis/rest/services/internal/Sugg_Composite_Locator/GeocodeServer')
                     }]
                }
            },

You also need to include the locator object in your viewer's define block before it can be used.

define(['esri/tasks/locator'], function(Locator){

source: https://developers.arcgis.com/javascript/3/jssamples/search_customlocator.html

BTW @tmcgee docs need updating here for the search widget: http://docs.cmv.io/en/latest/widgets/Geocoder/

Maybe we should leave this open till the docs are fixed.

green3g avatar Nov 09 '16 19:11 green3g

@roemhildtg I think the current documentation is accurate for the Esri Geocoder widget but perhaps it should be removed since that widget is no longer supported by Esri.

Your comment above is a good start at documentation for the newer Esri Search widget. (hint, hint. 😉)

tmcgee avatar Nov 09 '16 20:11 tmcgee

I know, its like every day I catch stuff like this and figure, I should update the docs or something else, and at the end of the day, its like...where'd the day go?

green3g avatar Nov 09 '16 20:11 green3g

thanks both of you. @tmcgee @roemhildtg. I download Search widget from here. Can I use it to replace geocoder?

JudyZhou avatar Nov 09 '16 23:11 JudyZhou

@JudyZhou You should not need to download anything. The example provided by @roemhildtg uses the Esri search widget which is part of recent versions of the Esri JavaScript API and so should work with your geocoder service.

tmcgee avatar Nov 09 '16 23:11 tmcgee

@tmcgee @roemhildtg I am working on ESRI Search widget. I got error at code locator: new Locator("http://cohgims.houstontx.gov/arcgis/rest/services/AddressLocators/Locator_composite/GeocodeServer"), error says: invalid URL. it is valid geocode service in public domain. if I use another geocode service locator: new Locator instead, got no error:("http://www.gims.houstontx.gov/ArcGIS/rest/services/Address_Locator_Zip_Street/GeocodeServer")

is restriction without www?

JudyZhou avatar Nov 10 '16 16:11 JudyZhou

@JudyZhou I found your problem. The search widget uses the endpoint /suggest which isn't supported by your version of ArcGIS Server. (suggestions started at 10.3).

This issue is beyond my area of expertise, you may want to reach out to Esri for support on configuring the search widget with your version.

green3g avatar Jan 13 '17 14:01 green3g

@roemhildtg Is the /suggest end point only for the type ahead functionality within the Esri search widget? My impression is the geocoding/search will still work. You just don't see the potential candidates as you type. I believe it also works at 10.3 when the suggestions are not explicitly enabled within the service.

I haven't spent a ton of time on this so may be off base. Is your experience with this different?

tmcgee avatar Jan 13 '17 17:01 tmcgee

Yeah, that sounds correct. I also just looked at the api page and found the option enableSuggestions @JudyZhou maybe if you set this to false it will fix the error messages.

green3g avatar Jan 13 '17 19:01 green3g