2
$\begingroup$

In GeoHistogram I can specify country or province bins but how do I specify a city bin?

GeoHistogram[
    <|Entity["City", {"Damad", "Jizan", "SaudiArabia"}] -> 81.7389, 
 Entity["City", {"AlHariq", "Riyadh", "SaudiArabia"}] -> 11.142, 
 Entity["City", {"Samitah", "Jizan", "SaudiArabia"}] -> 78.9526, 
 Entity["City", {"Yanbu", "Medina", "SaudiArabia"}] -> 18.7803, 
 Entity["City", {"AdDiriyah", "Riyadh", "SaudiArabia"}] -> 24.1361, 
 Entity["City", {"UmmLajj", "Tabook", "SaudiArabia"}] -> 6.57388, 
 Entity["City", {"AlUwayqilah", "Northern", "SaudiArabia"}] -> 
  54.2247, Entity["City", {"AlQuwayiyah", "Riyadh", "SaudiArabia"}] ->
   23.1155, 
 Entity["City", {"AbuAris", "Jizan", "SaudiArabia"}] -> 39.6006, 
 Entity["City", {"AdDilam", "Riyadh", "SaudiArabia"}] -> 70.0474|>,
    "AdministrativeDivision",
    PlotLegends->Automatic,
    ImageSize->Large
]

If I change "AdministrativeDivision" to "Country" it still works but if I change to "City" I get an error. Does Mathematica not support city level bins since it doesn't know city boundaries?

$\endgroup$
1
$\begingroup$

Not all entities have all properties as it depends if the data is available and if the data can be licensed by Wolfram. In this case, these city entities do not have a geo-polygon associated with them.

Entity["City", {"Damad", "Jizan", "SaudiArabia"}]["HasPolygon"]
False

You can change your bin specification to use the entity Position property instead. Change AdministrativeDivison to {"Hexagon", Quantity[30, "Kilometers"]} (or some other option) to have hexagons drawn at those locations.

If you find GIS shapefiles for the cities then you can create your own geo-histogram with GeoGraphics.

Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.