comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to extract pixel values from a GeoTIFF using an Esri Shapefile
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to extract pixel values from a GeoTIFF using an Esri Shapefile [message #93124 is a reply to message #74092] Fri, 29 April 2016 06:36 Go to previous message
ittai9 is currently offline  ittai9
Messages: 1
Registered: April 2016
Junior Member
Hello,

Was it successful to convert shpfiles to ROIs of ENVI?
Is there a way to do it?

Best,


On Thursday, December 23, 2010 at 2:53:55 PM UTC-6, PMagdon wrote:
> Dear all,
> currently I am developing an pure IDL (No ENVI functions) based remote
> sensing application which involves supervised classification.
> Therefore I need to import a Geotiff with the raster data plus an ESRI
> shapefile (Polygons) with the trainings-data. I then converted the
> shape file to an IDLanROI object and build a mask using
> IDLanROI::ComputeMask method. At this point I got stuck as I don't
> know how spatially link both image and roi even when they are in UTM
> projection.
>
> Here is my code so far:
> ;Import Multispectral Geo TIFF
> img=READ_TIFF('some_multispectral.tiff',GEOTIFF=geokeys,inte rleave=2,)
> s= SIZE (img, /DIMENSIONS)
>
> ;Setup Map projection based on GeoTIFF tags (UTM 17N, Wgs84)
> mapCoord = GeoCoord(img(*,*,1),geokeys)
> mapStruct = mapCoord -> GetMapStructure()
>
> ;import shapfile (aggain UTM 17N, Wgs84)
> myshape=OBJ_NEW('IDLffShape', 'some_esri_multipolygone.shp')
>
> ;Get the first polygon
> ent=myshape->IDLffShape::GetEntity(1)
>
> ;Convert SHP to ROI object
> myroi = OBJ_NEW( 'IDLanROI',( *ent.vertices)[0,*] ,(*ent.vertices)
> [1,*] )
>
> ;Apply ComputMask method
> maskResult = myroi -> ComputeMask(DIMENSIONS = [s[0],
> s[1]],MASK_RULE=2)
>
> ; Here starts the problem; I have a 5000x5000 raster (img) and the
> image coordinate system start with [0,0] but the myroi coordinates are
> much higher (eg 227984.00 ; 991472.00) Thus everything is masked.
> ;There is a keyword LOCATION for ComputeMask but I am not sure how to
> use it and where to get the right values for it
>
> index= WHERE(maskResult gt 0)
> subset=img(index)
>
> OBJ_DESTROY, myshape
> OBJ_DESTROY, myroi
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ITools and CentOS 6.7
Next Topic: Is there a way to tell if program is running within the IDLDE?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:55:53 PDT 2025

Total time taken to generate the page: 0.00437 seconds