Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set extent of the map into envelope which sizes are defined by user in miles(kilometers, whatever human readable unit). How to make it? I wrote the following code:

static void ZoomToPoint(IActiveView focusMap, ExportJson2Feature.Geometry geom)
    IPoint point = new PointClass();
    point.PutCoords(geom.X, geom.Y);

    IEnvelope newExtentEnvelope = point.Envelope;
    newExtentEnvelope.Expand(1, 1, false);
    ((IGeometry)newExtentEnvelope).Project( ((IMap)focusMap).SpatialReference );
    focusMap.Extent = newExtentEnvelope;

How to make it know that sizeX/sizeY are in miles?

share|improve this question
up vote 7 down vote accepted

Geometry's coordinates are always specified in its spatial reference's units. Unit conversions are best done by using the UnitConverter class.

If that's any help, you can determine the currently used map units by IMap.MapUnits.

If your point coordinates are in lat/lon (such as the WGS84 spatial reference), you probably want to decide on a projected coordinate system first and use that when working with distances.

share|improve this answer

If your extent will be covering a large range of latitudes or areas near the poles, you may benefit from calculating the extent using a geodesic distance from the centroid.

You can use IConstructGeodetic.ConstructGeodesicCircle to create a polygon. Then you can invoke IGeometry.Envelope to get an envelope.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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