Event Calendar map misbehaving with long/lat coordinate

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
4/22/2013 2:49:06 PM
Gravatar
Total Posts 537
feet planted firmly on the ground

Event Calendar map misbehaving with long/lat coordinate

I want to show a map for a rural location that has no name or post code. I know I can enter a coordinate for the "location" of a calendar entry, in this case 51.912562 -3.4204763.

If I go to Google Maps and type this into the search box, it takes me to exactly the right location.

However in the mojo Event Calendar, it takes me to a location about 3km north east. Very puzzling, until I noticed that Google Maps is also displaying the same bad location as point "A" in its results panel on the left as "2 Cefn Catref". I need to zoom out a bit to see the location.

I'm guessing mojo is using a gmaps api search method and then centering the map on the first result?

I'm not very familiar with the Google Maps API at the moment, but it seems this should be avoidable behaviour when a coordinate is entered (which Google can parse).

4/22/2013 2:57:30 PM
Gravatar
Total Posts 18439

Re: Event Calendar map misbehaving with long/lat coordinate

Are you putting a comma between the lat and long? You should, it is expected and without that it would just try to search instead.

4/22/2013 3:24:24 PM
Gravatar
Total Posts 537
feet planted firmly on the ground

Re: Event Calendar map misbehaving with long/lat coordinate

Same result with a comma.

4/22/2013 3:33:12 PM
Gravatar
Total Posts 18439

Re: Event Calendar map misbehaving with long/lat coordinate

does it behave different than the google maps feature using the same location?

Have you had any success with other locations using long and lat?

can you create the problem on the demo site? I'll take a look in the morning.

Best,

Joe

4/23/2013 1:59:30 AM
Gravatar
Total Posts 537
feet planted firmly on the ground

Re: Event Calendar map misbehaving with long/lat coordinate

Yes the normal Google Map feature behaves the same.

Yes it's the same on the demo site. I've set both the Google and Bing maps to the same coordinate here https://demo.mojoportal.com/map and the Bing map displays the correct location, the Google map the wrong one.

4/23/2013 7:53:23 AM
Gravatar
Total Posts 18439

Re: Event Calendar map misbehaving with long/lat coordinate

You did not answer the question about whether other locations using lat long are working correctly?

If this problem only affects specific coordinates I'm not sure whether I can solve it. As far as I know if you enter a comma separated lat/long the script is creating the center point of the map using the lat long, otherwise it is treating it as an address and trying to geocode it to get a point.

Best,

Joe

4/23/2013 1:58:50 PM
Gravatar
Total Posts 537
feet planted firmly on the ground

Re: Event Calendar map misbehaving with long/lat coordinate

Well I've tried a bunch of other coordinates, and found that the location between Bing and Google maps is always different, which suggests that none work correctly in GM and it always doing a search for the nearest (indexed location?) to the entered coordinate.

It certainly isn't centering the map on the coordinate, so perhaps the API has changed behaviour. It clearly understands that this is a coordinate or the search itself wouldn't work.

Is there any way of switching the Event Calendar to use Bing maps? That would solve it for me.

 

4/25/2013 2:14:42 PM
Gravatar
Total Posts 18439

Re: Event Calendar map misbehaving with long/lat coordinate

I dug into this further and found there was a bug in our javascript that was detecting if the entered location was a lat long, so it was not creating a point, but was trying to geocode it like an address. I'm not the one who implemented support for using lat long, originally it only supported addresses, I think the guy who implemented it did not test with any negative values for lat long based on the original regex.

This is fixed now in the source code repository and on the demo site.

Thanks,

Joe

4/26/2013 12:35:43 AM
Gravatar
Total Posts 537
feet planted firmly on the ground

Re: Event Calendar map misbehaving with long/lat coordinate

Perfect Joe, that's nailed it.

I've fixed it for my site (in advance of next upgrade) by borrowing mojogmaputilsv3-v3.js from the demo site and renaming it to mojogmaputilsv3-v2.js in mine.

 

 

 

You must sign in to post in the forums. This thread is closed to new posts.