|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Getting active layer as a GvShapes ObjectHey Folks, I'm hitting walls due to lack of docs. So hopefully you can help. I am programming a tool within the Fwtools implementation of OpenEV to georef aerial images. I have a tool Gui that will ask the user what image they want to open. As a step in the process I open the image as a layer and start an empty layer to collect GCP's (ground control points). In my current function I am trying to reclaim the GCP layer as a shape that I can manipulate. Howevere I can not load it as a shapes layer as an instance. But I don't want to creat a new file. This are the functions I used to create the two layers Essentialy
I have not saved a SHP file of the layer yet. Is this needed so I can edit the layer? I was tryign to repeat the tutorial backwards working from the selection manager down towards a GvShapes element. Please help me in the right direction while keeping in mind I'm new to Python. Cheers =======================================
.
----------- outside GUI CLASS)
# load reference index image when you click NEW button
# Add a layer to the view
.
# Collect and save points as WKT (Well Known text) file
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
|
|
Re: Getting active layer as a GvShapes Objectyou don't need to save the shapes layer as a file to manipulate it. What is not working? - William Hughes Sampson, David wrote:
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
|
|
Re: Getting active layer as a GvShapes ObjectThe missing key was
gcp_data = gcp_layer.get_parent()
I guess this takes the active layer and fetches all the
data associated with the shape.
I can now query point volues like this
# grab location of GCP corners
GCP_corners = { "UL" : gcp_data[0].get_node(0), "UR" : gcp_data[1].get_node(0), "LR" : gcp_data[2].get_node(0), "LL" : gcp_data[3].get_node(0) } return GCP_corners next I have to figure out how to bring up the vector
editing tools in the script and limit the shape to four
points.
Thanks for looking at the code... I have a hard time
figuring out where to go next at each step. I spend 90% of my time with dir()
and help()... is there an easier way to find out what I can do at each
stage?... It took me a long time to figure out the
gcp_data[0].get_node(0), because this is not documented in dir(gcp_data)
but is when I do a dir(gcp_data[0]).
all the instances are screwing me up.
Any good resources?
I think I've exhuasted the online developers tutorial. It
certainly is not exhaustive.
Cheers From: William Hughes [mailto:whughes@...] Sent: May 29, 2007 12:50 To: Sampson, David Cc: openev-discuss@... Subject: Re: [Openev-discuss] Getting active layer as a GvShapes Object you don't need to save the shapes layer as a file to manipulate it. What is not working? - William Hughes Sampson, David wrote:
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
|
|
Re: Getting active layer as a GvShapes ObjectSampson, David wrote:
>The missing key was > >gcp_data = gcp_layer.get_parent() > > >I guess this takes the active layer and fetches all the data associated >with the shape. > > As noted in gview.py where the get_parent menber function of GvData is defined This is typically used to get the underlying GvData on which a GvLayer (which is also a GvData) depends. In this case, the underlying GvData is a GvShapes which acts like a list of shapes. Hence gcp_layer.get_parent()[0] is a GvShape which has a get_node member function. So while in this case get_parent fetches all the data associated with the shapes (not shape) in other cases it may do something else. > >I can now query point volues like this > ># grab location of GCP corners > GCP_corners = { > "UL" : gcp_data[0].get_node(0), > "UR" : gcp_data[1].get_node(0), > "LR" : gcp_data[2].get_node(0), > "LL" : gcp_data[3].get_node(0) > } > return GCP_corners > > >next I have to figure out how to bring up the vector editing tools in >the script and limit the shape to four points. > >Thanks for looking at the code... I have a hard time figuring out where >to go next at each step. I spend 90% of my time with dir() and help()... >is there an easier way to find out what I can do at each stage?... It >took me a long time to figure out the gcp_data[0].get_node(0), because >this is not documented in dir(gcp_data) but is when I do a >dir(gcp_data[0]). > >all the instances are screwing me up > > >Any good resources? > > I spend a lot of my time in the pymod subdirectory of OpenEV. In particular the gview.py file (which I just open in a text editor) is very useful. I work out how to do a lot of stuff by looking at examples (especially the stuff in tools, check out rendertest.py) - William > >I think I've exhuasted the online developers tutorial. It certainly is >not exhaustive. > > >Cheers > >________________________________ > >From: William Hughes [mailto:whughes@...] >Sent: May 29, 2007 12:50 >To: Sampson, David >Cc: openev-discuss@... >Subject: Re: [Openev-discuss] Getting active layer as a GvShapes Object > > >At first glance I can't see a problem here. As far as I know, >you don't need to save the shapes layer as a file to manipulate it. > >What is not working? > > - William Hughes > >Sampson, David wrote: > > Hey Folks, > > I'm hitting walls due to lack of docs. So hopefully you can >help. > > I am programming a tool within the Fwtools implementation of >OpenEV to > georef aerial images. > > I have a tool Gui that will ask the user what image they want to >open. > As a step in the process I open the image as a layer and start >an empty > layer to collect GCP's (ground control points). > > In my current function I am trying to reclaim the GCP layer as a >shape > that I can manipulate. Howevere I can not load it as a shapes >layer as > an instance. But I don't want to creat a new file. > > This are the functions I used to create the two layers > > Essentialy > 1. A button is pressed that calls bu_new_clicked event > 2. I gather some info t=from the GUI > 3. I load the image requested by the user > 4. I pass gcp_shape the name of a roll of photos. An empty layer >is > created > 5. (currently commmented out) I call gcp_points to start >interactively > selecting my GCP's > > I have not saved a SHP file of the layer yet. Is this needed so >I can > edit the layer? > > I was tryign to repeat the tutorial backwards working from the >selection > manager down towards a GvShapes element. > > > Please help me in the right direction while keeping in mind I'm >new to > Python. > > > Cheers > > ======================================= > ------------- within GUI CLASS--------- > def bu_new_clicked(self, widget, data): > print "NEW" > #create new GCP shape with rollnum as name suffix > # > #gcp_shape(roll_num) > > #capture photo number as photnum > photo_num = self.ent_info_ref.get_text() > roll_num = self.ent_info_roll.get_text() > > # load image to use for index to collect GCP's > load_ref_img(self.ent_info_index.get_text()) > > #create new GCP shape with rollnum as name suffix > gcp_shape(roll_num) > > #capture four GCP points > # gcp_points(roll_num) > > . > . > . > > ----------- outside GUI CLASS) > def gcp_shape(roll_num): > shape_name = "GCP_%s" % roll_num > shape_gcp=gview.GvShapes(name=shape_name) > > layer_GCP = gview.GvShapesLayer(shapes=shape_gcp) > > gcp_view=gview.app.sel_manager.get_active_view() > gcp_view.add_layer(layer_GCP) > #add_layer(layer_GCP) > > # load reference index image when you click NEW button > def load_ref_img(ref_img): > > # load image into mem > img_ref_file = gdal.Open(ref_img) > # Turn it into a GvRaster > img_ref_rast = gview.GvRaster(dataset=img_ref_file) > img_ref_layer = gview.GvRasterLayer(raster=img_ref_rast) > ref_view=gview.app.sel_manager.get_active_view() > ref_view.add_layer(img_ref_layer) > #add_layer(img_ref_layer) > #gcp_shape(roll_num) > print "reference image is : " + ref_img > > # Add a layer to the view > def add_layer(layer): > current_view=gview.app.sel_manager.get_active_view() > current_view.add_layer(layer) > > . > . > . > > > > # Collect and save points as WKT (Well Known text) file > def gcp_points(roll_num): > print "collecting GCP locations from photo" > gcp_name = "GCP_" + roll_num > print "GCP FILE: " + gcp_name > > cview = gview.app.sel_manager.get_active_view() > cview.set_active_layer(gcp_name) > gcp_layer = cview.get_named_layer(gcp_name) > > > # open GCP layer > # create layer object > # create data object > # change to point edit mode > # interactively click to choose GCP's > # collect four points > # return point locations as dictionary > > > > > >________________________________ > > > >------------------------------------------------------------------------ >- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and >take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > >________________________________ > > > _______________________________________________ > Openev-discuss mailing list > Openev-discuss@... > https://lists.sourceforge.net/lists/listinfo/openev-discuss > > > > > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
|
|
Openev polygon export bugI tried to post to openev-announce,
but that is probably misplaced, so I'm reposting here
:
Dear
list,
juste wanted to
report a suprising behaviour about shapefile export.
When exporting a
vector as a shapefile, using menu "File->Save Vector layer", I always obtain
inversed polygons :
the areas with a
filled inside are exported counterclockwise, and those with filled outside are
exported clockwise.
This can be eaisly
checked with ogrinfo -al <myshapefile.shp>
Note : generated
shapefiles can then be reread afterwards by either openEv or GDAL, since
they apply inside/outside auto detection, and don't rely on the shapefiles
rings beeing properly ordered.
I applied a quick
patch, systematcally reversing each polygon's vertices, and it seems to
work fine (See attached file, line 486->513)
has this issue
already been detected / fixed ? I'm
using a version of OpenEv from CVS
(:pserver:anonymous@...:2401/cvsroot/openev, extracted
around July 2006)
regards,
Frederic
Claudel
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
|
|
Re: Openev polygon export bugFrederic Claudel wrote:
> I tried to post to openev-announce, but that is probably misplaced, so > I'm reposting here : > > Dear list, > juste wanted to report a suprising behaviour about shapefile export. > > When exporting a vector as a shapefile, using menu "File->Save Vector > layer", I always obtain inversed polygons : > the areas with a filled inside are exported counterclockwise, and those > with filled outside are exported clockwise. > This can be eaisly checked with ogrinfo -al <myshapefile.shp> > > Note : generated shapefiles can then be reread afterwards by either > openEv or GDAL, since they apply inside/outside auto detection, and > don't rely on the shapefiles rings beeing properly ordered. > > I applied a quick patch, systematcally reversing each polygon's > vertices, and it seems to work fine (See attached file, line 486->513) > > has this issue already been detected / fixed ? I'm using a version of > OpenEv from CVS > (:pserver:anonymous@...:2401/cvsroot/openev, > extracted around July 2006) Frederic, I think the safer form of fix would be to call SHPRewind() on the SHPObject. It is intended to "properly" set the winding order of rings. I'm pretty confident that this problem hasn't been fixed. I'd encourage you to file a bug report on the issue, and assign it directly to me. Best regards, -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@... light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | President OSGeo, http://osgeo.org ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
| Free Forum Powered by Nabble | Forum Help |