I’m interested in the feature of OSM where, if you search for a geographical entity, the found item will be nicely outlined with a polygon, and the zoom level of the map will be so that the polygon will fit into the viewport, no matter how big or small the entity is.
For example here’s what I mean concerning Uruguay: Relation: Uruguay (287072) | OpenStreetMap
Our experts are able to choose geographical entities of various sizes from a controlled vocabulary—as we like to call it in humanities—as their areas of interest; for example, “Uruguay” as a whole country, or “Montevideo” as a city (in this case the capital of Uruguay), or “Treinta y Tres” as a department (in this case one of Uruguay’s). Each of these entities is associated with a latitude and longitude pair which, to my understanding, points to the geographical center of the respective entity.
Now, I figure that there is a way of getting the (possibly many) latitude-longitude pairs that are needed in order to achieve this, that is, to draw the polygon using Leaflet. Another map application, mapy.cz from the Czech Republic, apparently does it this way, inferring from how they build their URLs. I strongly believe that mapy.cz uses OSM under the hood.
Or is there another way to do it? Please give me a hint in which direction to carry on
With best regards from the Ibero-American world!
3 posts - 2 participants
Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/how-to-draw-a-polygon-as-an-outline-of-a-given-geographical-entity/6777