2

Is there an example of how we can extract the z value from a shp file given the x,y coordinate value (namely utm) using gdal/ogr c++ lib?

alternatively, would it be easier if we convert the shp file into raster layer format and read off value from there?

Would it be easier?

Is there some examples of how this could be done?

2
  • What type of geometry is your shapefile?
    – user2856
    Jun 29, 2014 at 22:01
  • Most of the feature are polygon type Jun 30, 2014 at 12:39

1 Answer 1

1

Manage to solve my problem.

THis can be done by instantiating OGR and openup a shapefile database, layers etc

Afterwhich, create a OGRPoint object with the neccessary lat lon input OGRPoint* pt = new OGRPoint(lat, lon);

set a spatial filter based on this point object on the layer

next extract the feature based on the filter resu;lt

Finally extract the field that is associated with elevation (field no 16 in my case)

Voila...the elevation

Your Answer

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

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