I'd like to fetch at most 10 000 points from GeoElevationData, regardless of the location's specification.

From my experience it usually fetches ~100-400k points or all available in case there are not so many.

  GeoDisk[Here, Quantity[#, "Kilometers"]]
, "Geodetic"
, "GeoPosition"
] & /@ {.1, 1, 10, 50, 100, 500}

enter image description here

I prefer to have fewer points faster and not have to care about reducing the size as I really can't use 200k anyway.

Can this be set automatically?


1 Answer 1


Since zoom levels increase on the length scale by a factor of 2, we can estimate the number of data points in a lat-lon rectangle for a given zoom level, and choose the best one.

$maxZoomLevel = 12;

geoElevationRegionZoomLevel[loc_, target_] :=
  Block[{deltaDegree, count8, est},

    (* spacing of points (in degrees) at GeoZoomLevel -> 8 *)
    deltaDegree = 0.0054931640625`;

    (* Estimate the points GeoElevationData will return at zoom level 8 *)
    count8 = (Times @@ Subtract @@@ GeoBounds[loc])/deltaDegree^2;

    est = Log[4, target/(count8 + Boole[PossibleZeroQ[count8]])];
    Clip[Round[8 + est], {1, $maxZoomLevel}]

Here's the zoom level that gets us closest to 10000 points for Illinois:

loc = Entity["AdministrativeDivision", {"Illinois", "UnitedStates"}];

zoom = geoElevationRegionZoomLevel[loc, 10000]

This zoom level gives us 11375 points, so it's the closest to 10000 we can get:

GeoElevationData[loc, "Geodetic", "GeoPosition", GeoZoomLevel -> zoom]

enter image description here

  • $\begingroup$ So far so good, thanks! $\endgroup$
    – Kuba
    Commented May 14, 2018 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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