Reverse Geo Code Lookup

Answered
1
0

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

  • You must to post comments
Best Answer
0
0

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.

  • Ewan Walker
    Thank you very much Tiago
  • You must to post comments
0
0

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.

Attachment
  • You must to post comments
0
0

Hi Ewan

I presume you mean a Google Maps error. Errors can have different origins:

  • GoogleMaps itself
  • GoogleMaps API
  • Wisej.Web.Ext.GoogleMaps
  • application itself

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

 

  • Ewan Walker
    Hi Tiago I investigated this at the time I got the error, which is coming from the Wise j extension. I am testing for Geocodes[0].IsError, however the error is generated by the call to reverse geo code so Geocodes[0].IsError, does not get executed, the coordinates used were lat 51.095800 long 0.034750 Regards Ewan
  • You must to post comments
0
0

Hi Tiago

I am getting the attached error, but only in certain locations

Any ideas?

Ewan

Attachment
  • You must to post comments
0
0

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:

  • Show Coords in a TextBox (for progress monitoring)
  • Show GoogleMaps on page load and hide as soon as possible
  • Auto fecth the address as soon as you get the coords
  • callback use example

 

Attachment
  • You must to post comments
0
0

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();

 

 

Attachment
  • Tiago (ITG)
    I’ll have a look. There is no sync method: either you use a callback or you await the Async method
  • You must to post comments
0
0

Hi Ewan,

Please attach a sample.

  • You must to post comments
0
0

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

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

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.

 

  • You must to post comments
0
0

Hi Tiago

Yes I need to perform Reverse geocoding. Can a do this via the WiseJ Google Maps Extension?

  • You must to post comments
0
0
  • You must to post comments
0
0

Hi Ewan,

If I understand it correctly you want to perform Reverse geocoding right?

  • You must to post comments
Showing 13 results
Your Answer

Please first to submit.