esri shape file [message #25781] |
Tue, 17 July 2001 14:14  |
HILBERMAN
Messages: 7 Registered: July 2001
|
Junior Member |
|
|
Hello,
I need some help figuring out how to manipulate shape files. Is there
a "straightforward" way to graphically display a polygon coverage?
Furthermore, how can I query a polygon coverage based on its different
levels (attributes?)?
Thanks!
Rachael
|
|
|
Re: ESRI shape file [message #72332 is a reply to message #25781] |
Mon, 30 August 2010 03:05   |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On Aug 28, 4:31 am, Klemen <klemen.zak...@gmail.com> wrote:
> There is an example of creating a point shape file in Help as Max said
> (see below). Creating a polygon is sligtly more difficult; if you need
> such an example let me know.
> Cheers, Klemen
>
> PRO ex_shapefile_newfile
>
> ;Create the new shapefile and define the entity type to Point
> mynewshape=OBJ_NEW('IDLffShape', FILEPATH('cities.shp', $
> SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=1)
>
> ;Set the attribute definitions for the new Shapefile
> mynewshape->AddAttribute, 'CITY_NAME', 7, 25, $
> PRECISION=0
> mynewshape->AddAttribute, 'STAT_NAME', 7, 25, $
> PRECISION=0
>
> ;Create structure for new entity
> entNew = {IDL_SHAPE_ENTITY}
>
> ; Define the values for the new entity
> entNew.SHAPE_TYPE = 1
> entNew.BOUNDS[0] = -104.87270
> entNew.BOUNDS[1] = 39.768040
> entNew.BOUNDS[2] = 0.00000000
> entNew.BOUNDS[3] = 0.00000000
> entNew.BOUNDS[4] = -104.87270
> entNew.BOUNDS[5] = 39.768040
> entNew.BOUNDS[6] = 0.00000000
> entNew.BOUNDS[7] = 0.00000000
> entNew.N_VERTICES = 1 ; take out of example, need as workaround
>
> ;Create structure for new attributes
> attrNew = mynewshape ->GetAttributes(/ATTRIBUTE_STRUCTURE)
>
> ;Define the values for the new attributes
> attrNew.ATTRIBUTE_0 = 'Denver'
> attrNew.ATTRIBUTE_1 = 'Colorado'
>
> ;Add the new entity to new shapefile
> mynewshape -> PutEntity, entNew
>
> ;Note that because this is a new shapefile, the index of
> ;the new entity is zero.
> entity_index=0
>
> ;Add the Colorado attributes to new shapefile.
> mynewshape -> SetAttributes, entity_index, attrNew
>
> ;Close the shapefile
> OBJ_DESTROY, mynewshape
>
> END
thanks. it works perfect.
Cheers,
Dave
@ Dear Klemen. Thanks I jut want to create a point point shape file.
|
|
|
Re: ESRI shape file [message #72340 is a reply to message #25781] |
Sat, 28 August 2010 04:31   |
Klemen
Messages: 80 Registered: July 2009
|
Member |
|
|
There is an example of creating a point shape file in Help as Max said
(see below). Creating a polygon is sligtly more difficult; if you need
such an example let me know.
Cheers, Klemen
PRO ex_shapefile_newfile
;Create the new shapefile and define the entity type to Point
mynewshape=OBJ_NEW('IDLffShape', FILEPATH('cities.shp', $
SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=1)
;Set the attribute definitions for the new Shapefile
mynewshape->AddAttribute, 'CITY_NAME', 7, 25, $
PRECISION=0
mynewshape->AddAttribute, 'STAT_NAME', 7, 25, $
PRECISION=0
;Create structure for new entity
entNew = {IDL_SHAPE_ENTITY}
; Define the values for the new entity
entNew.SHAPE_TYPE = 1
entNew.BOUNDS[0] = -104.87270
entNew.BOUNDS[1] = 39.768040
entNew.BOUNDS[2] = 0.00000000
entNew.BOUNDS[3] = 0.00000000
entNew.BOUNDS[4] = -104.87270
entNew.BOUNDS[5] = 39.768040
entNew.BOUNDS[6] = 0.00000000
entNew.BOUNDS[7] = 0.00000000
entNew.N_VERTICES = 1 ; take out of example, need as workaround
;Create structure for new attributes
attrNew = mynewshape ->GetAttributes(/ATTRIBUTE_STRUCTURE)
;Define the values for the new attributes
attrNew.ATTRIBUTE_0 = 'Denver'
attrNew.ATTRIBUTE_1 = 'Colorado'
;Add the new entity to new shapefile
mynewshape -> PutEntity, entNew
;Note that because this is a new shapefile, the index of
;the new entity is zero.
entity_index=0
;Add the Colorado attributes to new shapefile.
mynewshape -> SetAttributes, entity_index, attrNew
;Close the shapefile
OBJ_DESTROY, mynewshape
END
|
|
|
|
|
Re: ESRI shape file [message #88863 is a reply to message #72340] |
Sun, 29 June 2014 14:43  |
ca11h
Messages: 3 Registered: June 2014
|
Junior Member |
|
|
Hi Klemen! I know this post is years old but I'm a student helping one of the researchers out at my school as he's hired me to do some IDL work...and well I've landed here searching for help.
If you get this I'd appreciate that polygon shapefile example you mentioned. I have a binary mask with many polygons and I need to turn it into a shapefile, and there's absolutely no resources helping me out online, save for possibly this post. If you could post that example or give me any advice at all I'd really appreciate it!
On Saturday, August 28, 2010 7:31:17 AM UTC-4, Klemen wrote:
> There is an example of creating a point shape file in Help as Max said
> (see below). Creating a polygon is sligtly more difficult; if you need
> such an example let me know.
> Cheers, Klemen
>
>
> PRO ex_shapefile_newfile
>
> ;Create the new shapefile and define the entity type to Point
> mynewshape=OBJ_NEW('IDLffShape', FILEPATH('cities.shp', $
> SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=1)
>
> ;Set the attribute definitions for the new Shapefile
> mynewshape->AddAttribute, 'CITY_NAME', 7, 25, $
> PRECISION=0
> mynewshape->AddAttribute, 'STAT_NAME', 7, 25, $
> PRECISION=0
>
> ;Create structure for new entity
> entNew = {IDL_SHAPE_ENTITY}
>
> ; Define the values for the new entity
> entNew.SHAPE_TYPE = 1
> entNew.BOUNDS[0] = -104.87270
> entNew.BOUNDS[1] = 39.768040
> entNew.BOUNDS[2] = 0.00000000
> entNew.BOUNDS[3] = 0.00000000
> entNew.BOUNDS[4] = -104.87270
> entNew.BOUNDS[5] = 39.768040
> entNew.BOUNDS[6] = 0.00000000
> entNew.BOUNDS[7] = 0.00000000
> entNew.N_VERTICES = 1 ; take out of example, need as workaround
>
> ;Create structure for new attributes
> attrNew = mynewshape ->GetAttributes(/ATTRIBUTE_STRUCTURE)
>
> ;Define the values for the new attributes
> attrNew.ATTRIBUTE_0 = 'Denver'
> attrNew.ATTRIBUTE_1 = 'Colorado'
>
> ;Add the new entity to new shapefile
> mynewshape -> PutEntity, entNew
>
> ;Note that because this is a new shapefile, the index of
> ;the new entity is zero.
> entity_index=0
>
> ;Add the Colorado attributes to new shapefile.
> mynewshape -> SetAttributes, entity_index, attrNew
>
> ;Close the shapefile
> OBJ_DESTROY, mynewshape
>
> END
|
|
|