简体   繁体   中英

Advice on how to scrape information off an interactiver map?

url = https://geoportal.minetur.gob.es/VCTEL/vcne.do If you follow the link it takes you a website containing an interactive map. This map shows all the telecommunications towers in Spain. However the towers only become visible if you are zoomed in enough(shaded area of the zoom bar). The towers are displayed as blue dots which when clicked on information is displayed. My objective is to scrape this information about every tower in Spain making sure I don't miss any out. I was just wondering if anyone could provide any insight on the best way of going about this.

Ive only thought of two things:

  • Manually move around the map clicking on all the towers that appear using selenium

  • There's a code associated to each tower which means I can access the information about that tower by just putting the code directly in the url however although the codes do have some order, some are completely random so I'll probably miss quite a few towers this way.

Any help appreciated!

Once you zoomed to the area the you can use the below code to get all the towers in the zoomed area and get the properties of each tower.

towers = driver.find_elements_by_css_selector("div#map image[id*='OpenLayers.Geometry']")
each tower in towers:
     # click on tower
     tower.click()
     # get the properties here

The only downside I see is there is no way to get all the towers in the country, we have to zoom to each area to show the towers.

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