Closed (fixed)
Project:
GMap Module
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Apr 2007 at 15:02 UTC
Updated:
15 May 2009 at 02:35 UTC
Jump to comment: Most recent file
The attached patch makes it possible to display 'polygon', 'rpolygon' and 'circle' shapes on the map again.
There are 2 problems remaining the 'rpolygon' and 'circle' shapes:
- the circles aren't really round, there's probably the earth-flattening missing in the calculation
- 'rpolygon' shapes have (more or less) the right radius, but the starting angle isn't taken from the 2nd point, but always set to 0
polygon-path with coordinates work fine, I'd appreciate fixes for or help with the other 2 issues.
Comments?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | gmap-shapes-5.patch | 7.19 KB | ray007 |
| #3 | gmap-shapes-4.patch | 9.79 KB | ray007 |
| #2 | gmap-shapes-3.patch | 8.74 KB | ray007 |
| #1 | gmap-shapes-2.patch | 9.42 KB | ray007 |
| gmap-shapes-1.patch | 7.19 KB | ray007 |
Comments
Comment #1
ray007 commentedA new patch with some fixes.
If possible we now use GPolyline instead of GPolygon and break up the lines into multiple segments, since the Google line drawing algorithm seems to have a problem with lines with many points when zooming in.
I'd really appreciate some feedback on my patches, or am I the only one trying to draw some routes on gmaps?
Comment #2
ray007 commentedA bit more google-research and I found out, that the caller is expected to make sure all parameters are really numbers and not strings.
If we do that, there's no need to split up the lines ...
Ignore patch #2, take this one ;-)
Comment #3
ray007 commentedstupid IE once again requires extra work, here a new patch to draw shapes in internet explorer too.
Be sure to have a look at the README.txt too ...
Comment #4
ray007 commentedall right, updating this patch worked automatically, here it is again ;-)
I'd also recommend maybe making 1 commit to the whole project just killing all trailing whitespace ...
Comment #5
bdragon commentedSlightly modified version committed. (Can't load on event markersready -- user may have shapes but no markers...)
Tested it a bit, it seems to draw lines at least.
Does this work OK?
Can I get some test macros?
Comment #6
ray007 commentedHaven't yet tried your new release, but the macro I used to test my patch with is:
including gpx-support also makes it rather easy to get some drawing on the map ...
and when we're at the shapes now: anybody got an idea why the circles aren't round?
Comment #7
bdragon commentedThe circles are not round because they are representing a constant distance from a central point.
Since the earth is round, it cannot be represented completely accurately on a flat plane. So we use a projection to draw it. All projections have tradeoffs.
Google uses the Mercator projection, a cylindrical map projection. Circles appear flattened because of
See http://en.wikipedia.org/wiki/Mercator_projection for more details.
Comment #8
bdragon commented(note to self, proofread first...)
It's possible that the circles ARE being drawn wrong, but I would put it down to projection distortion.
Try zooming way in on the equator and drawing a circle there. It should be nearly round.
Comment #9
Dewi Morgan commentedDefinitely not projection distortion. After some testing, I see that the shape of the circle depends on the google map's window shape: if you have it wider than it is tall, your circles will be squashed vertically; if the view is square, the circles will be round; if the view is tall, then your circles will be stretched proportionately taller too.
So until that's fixed, use square views if you want round circles. Not possible for me, since our ward is not square http://stleonardsward.org.uk/ward_map (not a gmap map, and won't be, until I get lines working)
In my "Build a Gmap Macro" page, I have three "Click map" options - "Points" and "Circles" work fine, but "Lines" does nothing. Using ray007's example macro above I only see the circle, not either of the lines - any idea what I'm missing?
So far, I've just downloaded the 2007-May-06 version from http://ftp.osuosl.org/pub/drupal/files/projects/gmap-5.x-1.x-dev.tar.gz and untarred it over my existing system, checked if there were any DB updates (there were none), and tried to draw lines. What did I miss out? Do I need this "xmaps" thing mentioned on http://www.webgeer.com/gmapdemo ?
Comment #10
Dewi Morgan commentedOK, I'm definitely wrong about it being the shape of the window :) What I'm actually seeing is that in creating a page with a gmap filter and using the example code above, I see a vertically-squashed circle.
But in the "build a macro" page, at the same coordinates and zoom level, any circle I draw is vertically stretched. Zooming out to view the whole world, the vertically-stretched circles are taller near the poles, circular at the equator. Goes nuts if your circle points go either side of the date line.
Still can't draw real lines :(
Comment #11
ray007 commentedcircles and rpolygons are special cases of lines.
I had a problem with FF2 on windows, where I couldn't see the lines with google-default style. FF2 on linux had no problems there, but ... maybe try to define a linestyle for the polygon ?
Comment #12
Carlos Miranda Levy commentedDo note that this patch does not work with the latest release Dated May 6, 2007.
:(
Comment #13
bdragon commentedI'm pretty sure all the bugs on this are gone.
Comment #14
(not verified) commentedComment #15
aren cambre commentedHow does this issue relate to #338740: Display locations as polygons on gmap views?