With the attached patch,
the Geocoder module may provide the following API Url endpoints (with Json output), to be consumed for performing direct Geocode and Reverse Geocode operations respectively, allowing also easy and custom implementation of Geocode Autocomplete inputs to third party (dependent) modules.
Geocode
This endpoint allows to process a Geocode operation (get Geo Coordinates from Addresses) on the basis of an input Address, the operational Geocoders and an (optional) output Format (Dumper).
Path: '/geocoder/api/geocode'
Method: GET
Access Permission: 'access geocoder api endpoints'
Successful Response Body Format: json
Reverse Geocode
This endpoint allows to process a Reverse Geocode operation (get an Address from Geo Coordinates) on the basis of an input string of atitude and Longitude coordinates, the operational Geocoders and an (optional) output Format (Dumper).
Path: '/geocoder/api/reverse_geocode'
Method: GET
Access Permission: 'access geocoder api endpoints'
Successful Response Body Format: json
NOTE:
The patch updates/integrates the Readme.md file with API Endpoints use parameters details.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | geocoder_api_url_endpoints_3_x_3077010_6.patch | 14.26 KB | itamair |
Comments
Comment #2
itamair commentedComment #3
itamair commentedComment #4
itamair commentedComment #5
itamair commentedSwitched too "geocoder" parameter name (singular) ...
Comment #6
itamair commentedadded 'formatted_address' and 'geometry' properties to standard "array" geocoder outputs format, to harmonize to the googlemaps geocoder output.
Comment #8
itamair commentedComment #10
1i1c commentedI recently installed Geocoder and think this will be a great feature. However, I cannot get the endpoint work with Google Maps
My assumption is that you can put the following site.com/geocoder/api/geocode?address=Address then the module will return JSON data from Google services. However, there is no response at all from the endpoint.
Please let me know if any further configurations are required
Thanks,
Comment #11
itamair commented@Ingo ... from what you describe it looks you are not complying (and not reading) the Readme.md documentation on the Geocoding API End Point:
https://git.drupalcode.org/project/geocoder/-/blob/8.x-3.x/README.md#geo...
Besides the "address" parameter also the "geocoder" is a required one ...
Also your Drupal Logs should give you evidence of the thrown exception.