X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 21 Mar 2005 01:33 PM by  anon
Shapefile problems
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
21 Mar 2005 01:33 PM
    I am trying to automate a process by creating an IDL program. As part of this process I have to convert thousands of points in text files into Shapefiles (polygons). I am able to create the new Shapefiles, however they don’t have any data. Here is the test code that I am dealing with: PRO shapefile myshape=OBJ_NEW('IDLffShape', FILEPATH('test7.shp', SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=5) new_vertices = [[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]] entNew = {IDL_SHAPE_ENTITY} entNew.SHAPE_TYPE = 5 p_ver = PTR_NEW(new_vertices) entNew.VERTICES = p_ver ;Add the new entity to new shapefile myshape->IDLffShape::PutEntity, entNew myshape->IDLffShape::Close OBJ_DESTROY, myshape END Thanks for the help, Henrique Momm

    Deleted User



    New Member


    Posts:
    New Member


    --
    21 Mar 2005 01:33 PM
    Hi, I have the same problem, I try to create a Shapefile with an PolylineZ and I can create the minimum and the maximum boundarys but without anything inside. Have you found an answer for your Problem? PRO test_1, x,y,z ;Create the new shapefile and define the entity type to Point ;mynewshape=OBJ_NEW('IDLffShape', FILEPATH('Staedte.shp', SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=18) mynewshape=OBJ_NEW('IDLffShape',("D:\mars\idl_out\mola_4.shp"), /UPDATE, ENTITY_TYPE=1) ;Set the attribute definitions for the new Shapefile mynewshape->IDLffShape::AddAttribute, 'test_1', 7, 25, PRECISION=0 mynewshape->IDLffShape::AddAttribute, 'test_2', 7, 25, PRECISION=0 mynewshape->IDLffShape::AddAttribute, 'test_3', 7, 25, PRECISION=0 ;Create structure for new entity entNew = {IDL_SHAPE_ENTITY} ; Define the values for the new entity entNew.SHAPE_TYPE = 18 entNew.BOUNDS[0] = min(x) entNew.BOUNDS[1] = min(y) entNew.BOUNDS[2] = min(z) entNew.BOUNDS[3] = 0.00000000 entNew.BOUNDS[4] = max(x) entNew.BOUNDS[5] = max(y) entNew.BOUNDS[6] = max(z) entNew.BOUNDS[7] = 0.00000000 entNew.n_vertices=0 ;idl_long? a=double(transpose([[x],[y],[z]])) ptr=ptr_new(a) entNew.vertices=ptr ;Create structure for new attributes attrNew = mynewshape->IDLffShape::GetAttributes(/ATTRIBUTE_STRUCTURE) ;Define the values for the new attributes attrNew.ATTRIBUTE_0 = 'blah_1' attrNew.ATTRIBUTE_1 = 'blah_2' attrNew.ATTRIBUTE_2 = 'blah_3' ;Add the new entity to new shapefile mynewshape->IDLffShape::PutEntity, entNew ;Add the Colorado attributes to new shapefile mynewshape->IDLffShape::SetAttributes, 0, attrNew ;Close the shapefilee OBJ_DESTROY, mynewshape END Thanks for your help Peter
    You are not authorized to post a reply.