I need to be able to return the latitude and longitude of where the person is using my Wise J app.
I also need to perform a reverse geocode lookup to get the postcode.
How do I use the geo location extension to do this? Ok got this working now
Does your Google Maps Extension perform reverse geocode lookup, if so how?
Many thanks for your help
Hi Ewan,
The Wisej.Web.Ext.GoogleMaps extension on GitHib was updated to support reverse geocoding.
The GoogleMaps example on GitHub was also updated and shows how to use the new feature. This sample now uses the Geolocation extension to find the browser’s current location coordinates: you can get the current coordinates and then get the postal address.
Hi Ewan,
It works all right this side as you can see by the attached screen shot. Please attach a sample where it does not work.
Hi Ewan
I presume you mean a Google Maps error. Errors can have different origins:
To exclude error origins, there are a number of things you can do.
First of all, are you checking Geocodes[0].IsError on your application?
Next thing, try to use these “certain locations” on GoogleMaps web page and on our GoogleMaps example on GitHub repository
Hi Tiago
I am getting the attached error, but only in certain locations
Any ideas?
Ewan
Hi Ewan,
The Wisej GoogleMaps is an extension for Wisej, meaning it’s intended to be shown on a web page (Wisej.Web.Page, Wisej.WebForm). So it won’t work unless you make it visible at least once. Making it visible forces the GoogleMap API scripts to load.
I attach back your solution with the following changes:
Hi Tiago
Aysnc sample attached
How do I use the sync version? Specifically insatiate Bb?
Map.GetGeocode(Bb, double.Parse(Latitude), double.Parse(Longitude));
Address = Bb[0].ToString();
Hi Ewan,
Please attach a sample.
Hi Tiago
I am missing something here – GeocoderResult[] never gets called
private string _lastQuery;
private GoogleMap Map = new GoogleMap();
private GeocoderResult[] _geocodes;
public string Address { get; private set; }
public GeocoderResult[] Geocodes
{
get { return _geocodes; }
private set
{
_geocodes = value;
}
}
private async void getAddress(string Latitude, String Longitude)
{
_lastQuery = $”Lat: {Latitude} Lng:{Longitude}”;
Geocodes = await Map.GetGeocodeAsync(double.Parse(Latitude), double.Parse(Longitude));
if (Geocodes[0].IsError)
{
MessageBox.Show($”Received error {Geocodes[0].ResultCode}”,
“Search Error”,
MessageBoxButtons.OK,
MessageBoxIcon.Error);
Geocodes = null;
}
else
{
Address = Geocodes[0].FormattedAddress;
}
}
Alternatively I think I need to call it synchronously.
Map.GetGeocode(Bb, double.Parse(Latitude), double.Parse(Longitude));
Address = Bb[0].ToString();
However how do I instantiate Action Bb?
Thanks
Ewan
Hi Tiago
Thanks.
I realised that I didn’t need Reverse Geocode as the data returned is usually based on the centre of a post code.
If instead I get the Site manager to capture the Latitude and Longitude at the Site itself, I can use this as a basis for comparison, moving forwards.
Tests show it is far more accurate that just getting the coordinates for a post code.
I want to be able to establish that when staff register their arrival at the Site they are actually there.
Hi Ewan,
Currently there is no support for Reverse Geoding in Web.Ext.GoogleMaps.GoogleMap
Support for Maps might change in the near future, following this thread about alternative maps libraries
I’ll register a feature request.
Hi Tiago
Yes I need to perform Reverse geocoding. Can a do this via the WiseJ Google Maps Extension?
Take a look at this:
Hi Ewan,
If I understand it correctly you want to perform Reverse geocoding right?
Please login first to submit.