简体   繁体   中英

OpenLayers : How to create markers based on a MySQL database

I have a MySQL database full of data about students (name, age, school, university, etc). What I want to do is to transform the data I got to markers on the map . To be more specific, I will for example calculate the number of students who study at the university X and come from town Y. The result of this request (a number) will be set on the map as a marker . I've been looking for such an example but couldn't find a corresponding one in the OpenLayers examples. Besides, concerning POI examples, most of them have a text file as a data source.

I will be very and very thankful for your help !

You have two options, get the data and: Generate the page and the according JavaScript dynamically (using PHP, or whatever). Make an ajax call to your server and serve the data serialized as JSON and feed it to some function which makes the according OpenLayer calls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM