Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [udig-devel] Shapefiles

Hi

Sorry about yesterdays rant.

If you have not lost all patients with me, I would really appreciate it
if anyone could tell me how I get the x, y coordinates of the drop from
my IDropAction class.

Thanks

Michelle

-----Original Message-----
From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of
M.S.Bachler
Sent: 13 March 2006 11:04
To: User-friendly Desktop Internet GIS
Subject: RE: [udig-devel] Shapefiles


Hi!

Thanks everyone for your various inputs.
I am still not sure what I am doing (I have decided I am just thick!).

I can't see how the DataUtility way or creating a FeatureType passes in
the x,y of the point. Then again, I can't even figure out how I get the
x, y coordinates of the drop from my IDropAction class in order to
create the coords for my Point class in the first place? I have run
around the API, but can't figure it out.

Is there really no example code out there that I can study to help me
understand things better. I am unable to download the source code with
Subversion (I did write to the list about this but no one replied). I
need the equivalent of "uDig for Dummies" book.

Being a Java developer for many years I thought this project would be
relatively easy. But I think having no familiarity with Eclipse or GIS
at all, has really not helped me. While Eclipse is becoming more
familiar, 'GIS speak' is still a mistery. I think what seems obvious to
many of you when talking about the code, just escapes me.

I know people are reluctant to spoon feed me the code I need.
I know I need to go through the pain barrier and try and understand it
all myself. But it really hurts, and for various reasons the timescale
of my project has been shrunk, and I am in danger (for the first time in
my lief!), of not completing something, and having to say I can't do it.

I think I have just not reached that eureka moment, when everything
suddenly clicks into place. I hope it happens soon! I still have a head
full of floating jigsaw pieces. 

Meanwhile, if someone could help me with how I get the x,y of the drop,
that would be great.

Michelle - ( with a heavy cold - feeling rather sorry for myself :-( -
going to get a cup of tea )

-----Original Message-----
From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jody
Garnett
Sent: 11 March 2006 08:58
To: User-friendly Desktop Internet GIS
Subject: Re: [udig-devel] Shapefiles


You guys are working to hard, I wrote a parser method I never wanted to 
do this stuff twice.
- 
http://udig.refractions.net/docs/api-geotools/org/geotools/data/DataUtil
ities.html

The format is silly, but it is in the javadocs:
- 
http://udig.refractions.net/docs/api-geotools/org/geotools/data/DataUtil
ities.html#createType(java.lang.String,%20java.lang.String)

basically: "name:String,age:Number,position:Point,*destination:Point"
Where the * indicates the default geometry ..

Other useful stuff:
- 
http://udig.refractions.net/docs/api-geotools/org/geotools/feature/Featu
reTypes.html

Jody
>
>
> M.S.Bachler wrote:
>>
>> Hi!
>>
>> Silly question.
>>
>> Earlier you helpfully gave me a code snippet to create a new
>> shapefile.
>>
>> IndexedShapefileDatastoreFactory fac=new 
>> IndexedShapefileDataStoreFactory();
>>
>> ShapefileDataStore ds=fac.createDatastore(url);
>>
>> // I assume this is the URL of the new shapefile I want it to create?
>>
>> GeometryFactory gf = new GeometryFactory();
>>
>> ds.createSchema( featureType );
>>
>> // Here I got lost. Started to investigate FeatureType and felt like 
>> I was walking through tar.
>>
> I did some stuff with FeatureType the other day... trying to create a 
> new Feature from scratch. Here is the code I found to create a new
> FeatureType:
>                     AttributeType geomAttr =
AttributeTypeFactory.newAttributeType("the_geom", LineString.class);
>                     FeatureType ftRoad =
FeatureTypeBuilder.newFeatureType(new AttributeType[] {geomAttr},
"road");
>                         
>     //                WKTReader wktReader = new WKTReader();
>     //                Point geometry = (Point) wktReader.read("POINT
(" + lat + " " + lon + ")");
>                     GeometryFactory geomFactory = new
GeometryFactory();
>                     LineString geometry =
geomFactory.createLineString(coords);
>                     Feature theRoad = ftRoad.create(new Object[]
> {geometry}, "myRoad");
>
>   
> This example Feature only has one attribute which is the geometry, 
> the_geom. You can create and add other attributes in the 
> AttributType[] and Object[] if needed.
>
> These classes are from the org.geotools.feature package.
>
> Hopefully you may find this useful. I'm not sure if this is the most 
> up-to-date way of doing it, but it worked for me.
>
> Mark
>
> --
> This message has been scanned for viruses and dangerous content by 
> *MailScanner* <http://www.mailscanner.info/>, and is believed to be 
> clean. _______________________________________________
> 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