TransWikia.com

Creating polygons over maps and extract the latitude/longitude?

Software Recommendations Asked by Maria on September 22, 2020

I’m looking for software recommendations in order to do the following:

  • Create a polygon (by clicking with a mouse) over an area on a map
  • Extract an array of latitudes/longitudes from the polygon points

Then ideally:

  • List cities within that polygon
  • Determine whether a given lat/long is within the polygon or not.

Have looked over several python libraries (Shapely, matplotlib, geopandas) and the Google Maps Javascript API but was hoping for more recommendations.

One Answer

Both the Bing Maps and Google Maps APIs could be coded to do the first (draw polygon and fetch vertices).

Points in polygons are more difficult if you are attached to a web page interface. If you are happy to put the polygons in a proper database, then Postgres/PostGIS, SQL Server, and Oracle can all do proper spherical point-in-polygon tests.

If the polygon is small (so that a Euclidean approximation is acceptable), then it can be easily coded up yourself. Point-in-polygon on a sphere is more involved - I've coded it up in C# in the past (been there, done that...)

Finally, querying cities: The Geonames database ( geonames.org ) is useful. You could easily filter the data to extract the city coordinates (ie. discard other features, POIs etc), and store those in a data file to query or in the database.

Answered by winwaed on September 22, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP