Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] working with gml

Thanks, that worked. I'm almost done with the functionallity. I can get the gml and wkt geometries from the map with an IOp and write the text to a text area field and I'm halfway on doing the reverse operation.

I can create the scratch layer with createTemporaryResource. I parse gml / wkt into a Geometry and add it to the scratch 'layer'. However I couldn't figure out how to add the scratch layer to the current map (I can do it from uDig but not from code).

On Tue, Feb 15, 2011 at 11:14 PM, Jody Garnett <jody.garnett@xxxxxxxxx> wrote:
This page has something:

The following ICatalog methods are used when working with a local catalog

  • createTemporaryResource( Object ) - used to create a temporary resources, usually by using a FeatureType
  • getTemporaryDescriptorClasses() - list of classes for which a temporary resource can be created

I did not see a code example.

My understanding is you can pass a feature type into createTemporaryResource.

-- 
Jody Garnett

On Wednesday, 16 February 2011 at 1:22 AM, Jaime Lop wrote:

The scratch layer seems to be the perfect solution for me, but I can't figure out how to create one programmatically. I've looked into the udig developers confluence but I'm a bit lost.

On Fri, Feb 11, 2011 at 4:34 AM, Jody Garnett <jody.garnett@xxxxxxxxx> wrote:
Depends how you want to do it; there is a facility to create a scratch layer (so you could place your GML or WKT on screen quickly - and then leave it up to the user if they want to save it to a shapefile or not).

You could also look at "paste" from walkthrough 2; it will take features copied form another layer and try and use them to create features in the currently selected layer.

You may even just be able to hack at that code so that if the clipboard contents is text that parses with WKT it is used as is?

Talk to Jesse for more details.

-- 
Jody Garnett
Sent with Sparrow

On Wednesday, 9 February 2011 at 6:06 PM, Jaime Lop wrote:

Thanks for your help. I was able to get the geometry and copy the kwt or gml. Now I have to figure out how to do the reverse: from a text field (wkt or gml) show a geometry on a map. I guess I'll need to create a shape or something and put it on a new layer?

Jaime

On Tue, Feb 8, 2011 at 11:20 PM, Jody Garnett <jody.garnett@xxxxxxxxx> wrote:
WKT is a suitable format; at one point you could "copy" a geometry to the clipboard; and "paste" it into your text document as WKT.
There is a preference page setting with respect to that.

Jody

On 08/02/2011, at 7:46 PM, Jaime Lop wrote:

When I have a geometry selected I only have the "Make Hole" and "Count" operations.

It's a good idea to use the workbench selection tutorial as an starting point. In fact I don't think I really need to get the gml, any format would be good for me.

Let's say I have a MultiPolygon. Is it WKT format the one I get from the toString method? I guess there is a better way to retrieve this than the method toString (??).

Jaime


On Tue, Feb 8, 2011 at 9:48 AM, Jody Garnett <jody.garnett@xxxxxxxxx> wrote:
Thinking.

For a geometry operation to work you may need to select the geometry with the edit tool.
You could also try an operation of a feature; or a feature collection.

Hey wait - you tried out the workbench selection tutorial. You can use that to sort out what is selected with the different tools and make your operation against that.

If that does not work we probably have a bug to look into :-P

Jody

On 08/02/2011, at 6:15 PM, Jaime Lop wrote:

Thanks for the quick response.

I've done the workbench and the distance tool tutorials and I think I have a good understanding now of how it works. However I cannot make the operation works.

I crearte my extension like this:

    <extension
         point="net.refractions.udig.ui.operation">
      <operation
            categoryId="net.refractions.udig.project.ui.informationOperations"
            class="com.example.GetGML"
            enablesFor="1"
            id="com.example.getGML"
            name="GetGML"
            targetClass="org.opengis.geometry.Geometry">
         <enablement></enablement>
      </operation>
   </extension>

Is org.opengis.geometry.Geometry the good targetClass? Should I see an entry in the contextual map menu or in the main menu?

I'm using AIXM 5.1 which extends gml 3.2 but I was trying to do it first with an example gml file (xml+xsd).

Jaime

On Mon, Feb 7, 2011 at 2:03 PM, Jody Garnett <jody.garnett@xxxxxxxxx> wrote:
Nice.

An operation will let you work on a Geometry (ie right click when the geometry is selected). You need to set the target class to Geometry...

- http://udig.refractions.net/confluence/display/DEV/5+Operations
- http://udig.refractions.net/confluence/display/DEV/Layer+Summary+Operation

>From there the GeoTools class "GML" will help you package it up.
- http://docs.codehaus.org/display/GEOTDOC/13+XML

There is however a problem; someone is lying to you (see the above page for details). GML is not a format that you can write out. You need to make your own schema; that extends GML ideas. Think of GML as abstract classes, or bits of document structure, it is up to you to define the shape of the file you want produced.

The way the web processing service handles it is with a small schema "envelope" that contains a single geometry.

Jody

On 07/02/2011, at 10:55 PM, Jaime Lop wrote:

> Hi all,
>
> I'm new to udIg. I'm trying to do a custom development but I don't know where to start.
>
> I want to make a tool that, based on a geometry selected from the map, converts it to gml 3.2 format.
>
> Where to begin? How do I retrieve the geometry from a selection? How can I open a gml 3.2 file with udig?
>
> Thanks,
> Jaime
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top