2

I have a point geometry that I'm trying to create geodesic buffers on. The input geometries are in a geographic coordinate system and I would like to specify linear units to buffer on. However I cannot find the correct implementation of the LinearUnitsClass to use.

If I create a buffer object with

IBufferConstruction buffer = new BufferConstructionClass()

I should be able to buffer a geometry input by specifying the distance units. However the input must be an Unit class object and I can't figure out how to implement that. I'm probably thinking about this the wrong way.

Main objective here is to take a point and find all features (in another layer) that are within 250 feet -- or to put it another way all features that intersect a 250 ft buffer on the input geometry. If I get the buffer polygon I can use a SpatialFilter object to pass to my feature search.

2 Answers 2

3

You need to use a SpatialReferenceFactory to create unit objects. So if I wanted a LinearUnit representing meters I could write the following:

ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironment() as ISpatialReferenceFactory;
IUnit unit = srFactory.CreateUnit((int)esriSRUnitType.esriSRUnit_Meter);
2

An approach is to do the unit conversion first from say metres into decimal degrees. Gives you the opportunity to test that the value is sensible before you plug it into the Buffer tools. Have a look at the IUnitConverter interface.

1
  • not sure if this is technically the "correct" solution but it does work and this is how I ended up implementing it. Commented Jun 18, 2018 at 19:08

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.