On Jun 10, 8:10 pm, Dommer <[email protected]> wrote:
> Okay, I see what you're saying here: take the centerpoints of all of
> the polygons, and select out the ones that are east of some
> easternmostpoint, west of some westermost point etc. But how could I
> get the easternmost and westernmost points... I suppose I'll have to
> do the calculation to figure out based on the original centerpoint...
> Yeah, that's possible.
I would suggest not using centre points, but rather the extreme
points. I have a similar problem in an application of mine.
I have a denormalised table containing the extents of the bounding
rectangle of my regions, and I get the regions any part of whose
bounding box lies within 0.0075deg of my reference point. I worked out
that 0.0075deg is all I need. There are server-side formulae you can
code to work out how many degrees 1000ft is at any particular
latitude.
SELECT DISTINCT region_id FROM extents_table
WHERE minlon<$cx+0.0075
AND maxlon>$cx-0.0075
AND minlat<$cy+0.0075
AND maxlat>$cy-0.0075
You could use a similar query but instead of using a circle around a
reference point, use the viewport bounds.
Having got the list of regions which are applicable, you then select
those boundaries from your boundary-points table and draw the lines.
You will be drawing regions which could lie some way away from the
viewport, but then that allows some ability to pan around.
If you don't want a denormalised table to speed things up, you could
get the minlon variables by using group functions on the boundary-
points table (which is how I populate the extents table):
select region_id,cc_code,min(lon),max(lon),min(lat),max(lat) from
boundary_points
where region_id = '$r'
group by region_id;
Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---