Developer forum

Forum » CMS - Standard features » GeoLocation field not getting coordinates

GeoLocation field not getting coordinates

John Broers
Reply

We have created a custom item type for a dealer locator where you can fill in address information and the option to select a location on a map which returns the GeoLocation.

We are using the standard Geolocation field from DynamicWeb and in the code we are passing the address field names as parameter. But after we save the item type without selecting any location on the map, but with all address fields filled, the coordinates become 0.000000 0.000000. I'm expecting that the coordinates get filled with coordinates based on the address fields. I filled in the Google Maps API key in the settings. The DW version we are testing in is 9.8.9.

I added a code snippet of the Item Type fields and a screenshot of the fields in the backend.

[Group("Adress")]
[Name("Streetname")]
public string AddressStreet { get; set; }

[Group("Adress")]
[Name("Housenumber")]
public string AddressNumber { get; set; }

[Group("Adress")]
[Name("Zipcode")]
public string AddressZipcode { get; set; }

[Group("Adress")]
[Name("City")]
public string AddressCity { get; set; }

[Group("Adress")]
[Name("Country")]
public string AddressCountry { get; set; }

[Group("Adress")]
[Name("Geolocation")]
[Geolocation(AddressFields = "AddressStreet,AddressNumber,AddressZipcode,AddressCity,AddressCountry")]
public string AddressGeolocation { get; set; }

GeoLocation.png

Replies

 
Vladimir Shushunov Dynamicweb Employee
Vladimir Shushunov
Reply
This post has been marked as an answer

Hi John,

I tried to reproduce the problem used your code snippet - but all works fine on my solution.
Could you check does Geolocation work in other places?
e.g. when you edit an user address in user management

And check please direct calls:

If you use API key:
https://maps.googleapis.com/maps/api/geocode/json?sensor=false&key={yourapikey}&address=Southam%27+Rd+Block+2-4+2+8226+Los+Angeles+USA+

if ClientID:
https://maps.googleapis.com/maps/api/geocode/json?sensor=false&client={yourclientid}&address=Southam%27+Rd+Block+2-4+2+8226+Los+Angeles+USA+

Best regards,
Vladimir

 

Votes for this answer: 1
 
John Broers
Reply

Hi Vladimir, 

Thank you for your reply.

Looks like this was indeed a problem with the API. The API was not authorized to use the Geocode API.

 

 

You must be logged in to post in the forum