Closed (fixed)
Project:
Geo
Component:
Geo API
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Apr 2009 at 04:34 UTC
Updated:
12 Aug 2009 at 17:10 UTC
Jump to comment: Most recent file
This is returning an array of points inside points for polygons and lines, because polygons and lines are parsed in a recursive fashion. The attached patch fixes it so that geo_wkb_get_data($wkb, 'array') always returns an array of lat/lon pairs--the same structure of points whether the data is a point, linestring, or polygon:
Array
(
[byte_order] => 1
[type] => polygon
[count] => 1
[value] => Array
(
[0] => Array
(
[0] => 41.469534
[1] => -88.263478
)
[1] => Array
(
[0] => 41.469534
[1] => -87.111162
)
[2] => Array
(
[0] => 42.154324
[1] => -87.111162
)
[3] => Array
(
[0] => 42.154324
[1] => -88.263478
)
[4] => Array
(
[0] => 41.469534
[1] => -88.263478
)
)
)| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 429654_array_and_formatters_some_views.patch | 4.17 KB | greggles |
| geo_wkb_get_array.patch | 747 bytes | becw |
Comments
Comment #1
becw commentedComment #2
gregglesAttached patch provides
1. bec's original array code
2. Updated formatters
3. Code in geo.module to make sure that the wkb is in wkb instead of {field_name_}wkb
4. Some initial work toward making views lat/lon work again, but this is still basically broken.
Comment #3
becw commentedI think that these things should go in separate patches--one patch for each significant fix/feature.
Comment #4
gregglesAfaict, the only piece that's unrelated to the original patch is #4 which doesn't even work and can easily be excluded because it's in a single file.
The rest are at least somewhat related to the way that this patch restructures the array.
Comment #5
becw commentedah, from your description it wasn't clear how 2 & 3 were related--I should have read the patch first (:
Comment #6
allie mickaHi all,
I wanted to keep an array structure that's compatible with the original data. A polygon may have more than one segment, so this may be really important.
Additionally, there's a *ton* of confusion surrounding X, Y, Lat, Lon, 0, 1, etc. I think it's really important to use keyed arrays to mitigate confusion. Thus, the structure looks like:
For polygons:
For linestrings
For points
It's still not 100% perfect, but I'm hopeful that the basic structure will work well. I have committed this change, which means that the code requiring this correction (namely GMAP Geo) will have to account for it. I'll file patches accordingly.
I have not addressed the formatters/other issues, though I can't reproduce them either?
Thanks!
Comment #7
swill commentedIs there any progress getting Geo points mapped in a Gmap View? I have tried everything I can think of including these patches and I have not been able to get the Geo points to map correctly.
Comment #8
becw commentedThis issue has been mostly resolved by recent commits -- http://drupal.org/cvs?commit=219310 -- but I'm finding that lat and lon are reversed in the array I get out of geo_wkb_get_array(). Possibly because WKT values are POINT(lon lat)?
Comment #9
becw commented