[OpenLayers-Users] Zoom to a region using drop down
selection box
Andrew de Klerk
andrew.deklerk at gmail.com
Mon Feb 4 03:04:15 EST 2008
Sindile
The filtering of your dropdowns would have to be done in the backend outside
of openlayers. That is, in your database design you would need to associate
municipalities with specific provinces, and towns with specific
municipalities. When a user selects a province the dropdown would then only
display those municipalities associated with the province. The same goes for
the selection of a municipality. Your markers would then also be associated
with a particular town. When a particular town is selected you would display
those associated markers. With regards to zoom to the extents of each of the
provinces and municipalities, You would need to associate a Centroid and
Zoom level with each of these items. Openlayers will not assist you in
"zooming to an polygon extent" (except for vectors of course).
Hope that helps
Andrew
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Intengu Technologies
Sent: 04 February 2008 09:09 AM
To: Users at openlayers.org
Subject: Re: [OpenLayers-Users] Zoom to a region using drop down selection
box
Josh,
I have the data, what I had done was to get the centroids of the polygons,
perhaps I need to get their bounding boxes and also indicate a specific zoom
level depending on whether province or municipality or town.
I know how to create the drop down menus, essentially I will have three drop
down boxes - province, municipality and province, but what I do not know how
to do is:
1. select from the drop down menu a specific province and zoom to its extent
1(a). once zoomed to a province only show municipalities that fall in that
province in the municipality drop down box
2. select from the drop down menu a specific municipality and zoom to its
extent
2(a). once zoomed to a municipality only show towns that fall in that
municipality in the municipality drop down box
3. select from the drop down menu a specific town and zoom to its extent
The reason I want to do this is to have markers linked to towns (examples of
markers are hotels, types of restaurants, bed and breakfast, bars, shopping
centers, tourist attraction facilities.)
Sorry for the long narration I am a newbie in openlayers and javascript,
examples of implementation would help or suggestion on how to better
implement my application.
Regards,
On 02/02/2008, Josh Livni <mailing_lists at umbrellaconsulting.com> wrote:
Sindile,
Are you asking how to create the data to fill in the dropdowns, or do
you already have this all figured out and are asking how to have
OpenLayers zoom to a location that you already have extents for?
And if you are asking how to create the dropdowns themselves, then do
you have source data that would let you do this dynamically (eg GIS data
for all municipalities and towns?)
Assuming you have the data, and have created the dropdowns, one general
method would be to have the VALUE of the dropdown item be the bounding
box of the municipality or town. Then you could have an onChange event
set for the dropdown that called a function to center the map
appropriately (map.zoomToExtent).
Assuming you don't have the dropdowns and/or data, then it's probably
not an OpenLayers question yet...
Hope this helps.
-Josh
Intengu Technologies wrote:
> I live is South Africa and the geocoding service offered by Google,
> Yahoo, Geonames are not comprehensive. What I would like to do is the
> following from a drop down selection box is for Province,
> Municipality, Town:
> 1. Select a province (have lat long of province - centroid) , google
> maps zooms to that province (this is similar to a State in USA)
> 2. The next drop down selection box only shows municipalities that
> fall within that province (have lat long of municipalities -
> centroids). Then on selection of municipality zoom to that
> municipality. Municipalities (list) should show once a province has
> been selected.
> 3. The next drop down selection box only shows towns that fall within
> that municipality (have lat long of towns). Then on selection of town
> zoom to that town. Town (list)should show once a municipality has
> been selected.
>
> Thank you in advance for your assistance I am still newbie in openlayers.
>
>
>
> --
> Sindile Bidla
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Sindile Bidla
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.17.0/1257 - Release Date: 2008/02/03
05:49 PM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080204/6b48422a/attachment.html
More information about the Users
mailing list