Get bounds of a US state

1,383 views
Skip to first unread message

matt wilson

unread,
Apr 1, 2011, 7:03:14 PM4/1/11
to Google Maps JavaScript API v3
Is there a straight forward way to querying the bounds of a state?

When I plot markers and I come across situations where they're all in
the same state, I don't want the zoom to come in tighter than the
whole state.

I understand the long hand way would be to find and store two opposing
lat,lngs for every state and include those in my bounds, but I was
looking for a less grueling method.

Thanks

Michael Geary

unread,
Apr 1, 2011, 7:59:31 PM4/1/11
to google-map...@googlegroups.com, matt wilson
There's a list of state bounding boxes you can copy out of the PolyGonzo source code:


Search the code for PolyMap.states for the list, and search for zoomToBounds to see an example of using one of the bounding boxes.

-Mike


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


geoco...@gmail.com

unread,
Apr 1, 2011, 8:45:40 PM4/1/11
to Google Maps JavaScript API v3
On Apr 1, 4:03 pm, matt wilson <mmat...@gmail.com> wrote:
> Is there a straight forward way to querying the bounds of a state?

The geocoder will return a bounding box of the state if you pass it in
to it, you can use that to zoom to the state level.

-- Larry

geoco...@gmail.com

unread,
Apr 2, 2011, 12:57:47 PM4/2/11
to Google Maps JavaScript API v3
On Apr 1, 5:45 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Apr 1, 4:03 pm, matt wilson <mmat...@gmail.com> wrote:
>
> > Is there a straight forward way to querying the bounds of a
> > state?
>
> The geocoder will return a bounding box of the state if you pass it
> in to it, you can use that to zoom to the state level.

Like this:
http://geocodezip.com/v3_zoom2stateSelectList.html
Reply all
Reply to author
Forward
0 new messages