My solution is to a somewhat larger problem--the user chooses from a wide variety of place names using a hierarchical browse that is brought into view using a sliding jQuery panel. This is at http://mrdata.usgs.gov/general/map.html and is invoked by clicking the green box labeled "PLACE NAMES"
The data infrastructure behind that is composed of a PostgreSQL table containing the area centroids, a formal thesaurus containing the place names themselves, the latter accessed using a simple web service written in PHP. You might be able to do this using a static JSON file, though, if you have far fewer places. The Javascript code at http://mrdata.usgs.gov/general/map.js shows how I call the OpenLayers function to zoom to the appropriate position. The actual zoom level for each area has been stored in the database along with the centroids. So this problem is a mixture of data and code. You probably can rearrange the code and data in many different ways, different than I did. Peter On Mon, Jul 14, 2014 at 6:57 AM, KhunSanAung <khunsanaung....@gmail.com> wrote: > Hi All, > > I'd like to build an map HTML page where I will have a list box populated by > the feature name from a specific layer. The list should automatically come > from the layer. > example the layer is USA State and the name of each state are in the list > box. > > When user select an item from the listbox, the map will zoom to that > feature. > example when user select 'California' from the list box, the map will > automatically zoom to 'California' state. > > Could someone please guide me how can I do it? > > Thank you very much in advance for any idea. > > -- > Have a nice day! > -- > > Mr. Khun San Aung > > > _______________________________________________ > Users mailing list > us...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-users -- Peter N. Schweitzer (U.S. Geological Survey, Reston, VA 20192) (703) 648-6533 email: pschweit...@usgs.gov http://geology.usgs.gov/peter/ _______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users