Marker positioning problem

ron_s - June 6, 2008 - 22:20
Project:gProximity
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have a map displayed that is 660x400 and a default zoom setting 4. This just about fits the entire continental US.

I have a few user profiles displayed on the map, and the marker positioning on the on the profiles at a zoom setting of 4 is way off. For example, a marker for Austin, TX shows up in the Gulf of Mexico, over 300 miles away. As I zoom in more, the marker keeps moving closer and closer to Austin until at the final step it is in the right place.

If you look at Google Maps, the marker never moves. Whether at zoom 0 or zoom 10, the marker does not move from its relative spot on the map.

#1

ron_s - June 6, 2008 - 23:08

Here's a comment about the issue: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/d701...

Is it possible that the warning: getimagesize(web/sites/all/modules/gproximity/markers/yellow.png) [function.getimagesize]: failed to open stream: No such file or directory in /htdocs/web/sites/all/modules/gproximity/gproximity.inc on line 321. error messages are causing the marker to not be set at the right size?

#2

ron_s - June 7, 2008 - 11:21

I've played around with this a bit more and I think I've found where your problem is located. First, one other comment ... in gpMap.js, around line 170, you redefine all the baseIcon values again, after they have been defined on line 22. Why? I just commented out all the options around line 170.

Second, this issue is tied to a problem with loading the markers. If I comment out icon.iconAnchor = new GPoint(iconSpecs.anchor[0],iconSpecs.anchor[1]); in the getIcon() function, the marker is put in the right spot. The issue has to be either in how the iconSpecs are being defined in loadMarkers(), or a possibly a core issue with the GMap API?

In the API spec, iconAnchor is listed of type "GPoint" in the GIcon definition (http://code.google.com/apis/maps/documentation/reference.html#GIcon), but yet using iconSpecs.iconAnchor in your code causes an error. Maybe GMap has a problem with having the icon definition passed between functions in an array?

Not sure what's going on here, but probably just going to comment out this line for now since it works otherwise.

#3

greenSkin - June 7, 2008 - 12:29

Ahh yes, I will remove the lines around 170 as I put those there only so I could reference them easily while writing the function just under them.

You can try around the 'icon.iconAnchor = new GPoint(iconSpecs.anchor[0],iconSpecs.anchor[1]);' entering in 'GLog.write(iconSpecs[0])' or 'GLog.write(iconSpecs[1])' and see what it renders out.

It could be possible that if you are having the issue with the getimagesize() function that iconAnchor is not getting set right as it is based on the marker image size.

#4

greenSkin - June 7, 2008 - 13:19

Are the markers that aren't positioning correctly clusters or one marker per node? If they are clusters make sure that each node has a latitude and longitude set or add a filter to the view to filter out nodes without latitudes or longitudes.

#5

ron_s - June 7, 2008 - 13:22

Well, it's not an issue with the getimagesize() function, since changing it to image_get_info didn't help. However, the GLog.write commands were useful and did shed a bit more light on the situation.

I'm not exactly sure why, but somehow the markers are getting offset by 10 pixels horizontally and 30 pixels vertically. If right above the icon.iconAnchor = new GPoint(iconSpecs.anchor[0],iconSpecs.anchor[1]); line of code I add the following, the marker gets placed correctly:

iconSpecs.anchor[0] = '10';
iconSpecs.anchor[1] = '30';

Also when I used, GLog.write, the initial values for iconSpecs.anchor were as follows:

iconSpecs.anchor[0] = -1
iconSpecs.anchor[1] =

The value for anchor[1] was blank.

#6

greenSkin - June 7, 2008 - 13:39

What is the 'image_get_info()' function return? The anchor is dynamically generated based on what 'getimagesize()' (will be changed to 'image_get_info') returns. So the fact that the iconSpecs.anchor values aren't showing the proper values tells me that the 'getimagesize()' ('image_get_info()') is not returning the proper information.

#7

ron_s - June 7, 2008 - 22:29

I'm not really sure the image_get_info() function is returning anything? There wasn't an easy way to just print it to the screen, so I stored it into a session variable and printed out the array.

Just as an example, I attempted to store into session the following: $_SESSION['markerSize']['extension'] = $markerSize['extension'];, then printed it to the screen. Nothing.

Definitely the substr($marker, 1) is getting passed into image_get_info(). The value of substr($marker, 1) is set as web/files/markers/green.png. Obviously an issue though, because green.png is what I set for the cluster, but a yellow icon is what is being displayed with the wrong offset on the map.

#8

mgenovese - June 10, 2008 - 14:17

Also have this very same issue. Subscribing.

#9

greenSkin - June 11, 2008 - 15:50
Status:active» fixed

This should be fixed now. Please test next available snapshot and let me know if the problem still exists.

#10

mgenovese - June 12, 2008 - 15:13

Looks good. Thanks!

#11

Anonymous (not verified) - June 26, 2008 - 15:24
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.