Have a look here: https://www.drupal.org/node/2330965

We're down as UK, but the map marker is somewhere in Norway.

Other listings have the same issue, EG: https://www.drupal.org/marketplace/code-enigma

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drumm’s picture

Project: Drupal.org site moderators » Drupal.org customizations
Version: » 7.x-3.x-dev
Component: Other » Code
dddave’s picture

Adding related issues. I reported it way back in #2184321: World map shows company locations way off but remember similar issues before that. I disagree with the minor qualification because it makes "us" look like amateurs (as I explained in my issue).

drumm’s picture

There are a couple things that could be wrong.

  1. http://cgit.drupalcode.org/drupalorg/tree/drupalorg/js/general.js#n17 converts the lat/lon to px.
  2. http://cgit.drupalcode.org/bluecheese/tree/sass/partials/drupalorg/_maps... styles the circle.
tvn’s picture

So the map marker doesn't show the company location. Whatever you enter in "Headquarters" text field won't be shown on the map. Markers show locations of company employees, and only those who agreed to share their location in their user profile. Torchbox has employees in Moldova and other places. Can it be possible that someone was actually located in that place and that's what got saved?

fenstrat’s picture

Priority: Minor » Normal

I can confirm the issue. The marketplace map seems to semi consistently place each organisational user several px too far East and North of their actual location.

As @drumm points out the likely culprit is the lat/long conversion to pixels or the css. For the conversion: http://cgit.drupalcode.org/drupalorg/tree/drupalorg/js/general.js#n17 which then call's geolocation's latitudeToPx()/longitudeToPx() http://cgit.drupalcode.org/geolocation/tree/modules/geolocation_html5/ge... - At a glance are those hardcoded parameters for leftLongitude and topLatitude, bottomLatitude could be off - not sure where they actually come from?

I'd have to agree with @dddave, this does make "us" look like amateurs, upping to Normal priority.

mgifford’s picture

It's off in Canada too https://www.drupal.org/marketplace/openconcept - we're properly listed as Ottawa, Canada in the Headquarters section.

Canada's a pretty big place, but it looks like Ottawa is real close to James Bay. I don't know how many hundreds of km this is off. Certainly in Europe the dot would be in another country.

I think this issue has come up before this though.

mrf’s picture

Confirming that this is still an issue, and there seems to be a consistent northeast misplacement of all the markers.

C3 Map example

Our map is showing San Francisco in the middle of Eastern Oregon and London on the Norway / Sweden border. The vast majority of our employees are in SF and have relatively up to date profiles, so I don't think this is a data issue.

dagmar’s picture

Status: Active » Needs review
FileSize
740 bytes

I've been playing a bit with this code running directly from the browser console:

$map = jQuery('#organization-map'); 
$map.find('>.drupalorg-map-pin').each(function () {
  jQuery(this).css({
    left: '' + Drupal.longitudeToPx(jQuery('>.longitude', this).text(), -162, $map.width()) + 'px',
    bottom: '' + Drupal.latitudeToPx(jQuery('>.latitude', this).text(), 75, -45, $map.height()) + 'px'
  });
});

At the company where I currently work we have developers at Mexico, Colombia and Argentina, which allowed me to found a quite accurate set of values that place the points quite near of where they should be placed.

Of course the use of 20px for the dots makes this less accurate than use for example a 14px dot, but in my opinion 14px is too small for this map.

You can try this by adding this style using the browser inspector.

.drupalorg-map-pin:before {
  font-size: 14px;
}

You could just try to paste the code posted above for a different company like lullabot and see if that is enough precise.

fenstrat’s picture

Status: Needs review » Reviewed & tested by the community

Nicely done @dagmar. I've tested with our organisation and several others and it's a big improvement. Where those hard coded values come in still seems a mystery, however these adjustments work, so marking as RTBC.

As for the font size, I agreed 20px is not great for accuracy however anything smaller and the dot seems to get lost.

drumm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +needs drupal.org deployment

I committed this to the module's dev branch, this will likely be deployed to Drupal.org later today or tomorrow.

These hard-coded values are the latitudes and longitudes of the map image's boundaries. We got the image without knowing those, and had estimated the boundaries visually.

  • drumm committed a474bfa on 7.x-3.x, dev authored by dagmar
    Issue #2335419 by dagmar: Map position on marketplace listings isn't...
drumm’s picture

Issue tags: -needs drupal.org deployment

This has been deployed. Since this is JS code, it may be cached for a few minutes longer by advagg, and longer if you are not logged in.

fenstrat’s picture

Great, thanks @drumm. I'm seeing the changes.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.