Ah.

The information is I think in the shapefile header; we do parse that shapefile 
header information into the AttributeDescriptor/AttributeType information 
(length as you found is captured as a filter "restriction"). I am not sure how 
much detail is provided in the shapefile format about floating point precision.

Time to look at the code; and stop in a debugger and see what you can find.

-- 
Jody Garnett


On Friday, 27 May 2011 at 12:19 AM, Jose C. Martinez-Llario wrote:

>  Hi Jody,
>  Sorry I didnt explain myself in a good way.
>  nono..Im not asking about how i can get a field value from a shapefile..of 
> course im not going to ask that with allthe geotools documentation on the 
> internet.
> 
>  Lets say I have a field called 'field1' and it has 20 digits of precision 
> and 8 digits of scale (decimal digits).
>  How can I know the precision and scale of any real shapefile field and how 
> can I set up this values when I want to setup a new sschema with these fields?
> 
> 
>  El 26/05/2011 16:12, Jody Garnett escribió: 
> > Bah this silly email program sends messages when I give up and close an 
> > email.
> > 
> > Can I assume that scale is an attribute you are trying to access? I am 
> > having a hard time answering your questions; as working with fields of 
> > different types works well with GeoTools shapefile support. 
> > 
> > You should be calling feature.getAttribute("scale") to access a field 
> > called scale; the result will be a number if that is what it is saved as. 
> > 
> > Examples of working with feature content here: 
> > - http://docs.geotools.org/latest/userguide/library/main/feature.html
> > 
> > 
> >  -- 
> >  Jody Garnett
> > 
> > 
> > On Friday, 27 May 2011 at 12:09 AM, Jody Garnett wrote:
> > 
> > > Can I assume
> > > 
> > >  -- 
> > >  Jody Garnett
> > > 
> > > 
> > > On Thursday, 26 May 2011 at 11:40 PM, Jose C. Martinez-Llario wrote:
> > > 
> > > > Dear GeoTools users,
> > > > 
> > > >  I am trying to read a shape file using geotools and everything is 
> > > >  working well.
> > > >  I couldnt find out how to read the scale from a real field though.
> > > > 
> > > >  For reading the precision I get the field restricctions and then I 
> > > >  parsed each element on the list (filter.toString()) looking for the 
> > > >  string 'length'.
> > > >  It is working for getting the length which makes me understand the 
> > > >  precision but I coudlnt find out how to get the scale.
> > > > 
> > > >  Im sure this is not the right procedure even for getting the lenght.
> > > > 
> > > >  I can not find out the opposite problem either. I mean how to write a 
> > > >  shape file and specify the precision and scale for a real shape file 
> > > > field.
> > > > 
> > > >  So I would like to know:
> > > >  1) How I can get the precision and scale from an existing shape file 
> > > > field.
> > > >  2) How I can set up the precision and scale when Im writing a new 
> > > > shape 
> > > >  file.
> > > > 
> > > >  Any help will be very appreciated.
> > > > 
> > > >  Cheers,
> > > >  Jose
> > > > 
> > > >  -- 
> > > > 
> > > >  ------------------------------
> > > >  José Carlos Martínez Llario
> > > > 
> > > >  Producción Cartográfica y SIG
> > > >  Dpto. Ingeniería Cartográfica, Geodesia y Fotogrametría
> > > >  Universidad Politécnica de Valencia
> > > > 
> > > >  E-mail: [email protected] (mailto:[email protected])
> > > >  Telf: 963877007 ext. 75599
> > > >  ------------------------------
> > > > 
> > > > 
> > > >  
> > > > ------------------------------------------------------------------------------
> > > >  vRanger cuts backup time in half-while increasing security.
> > > >  With the market-leading solution for virtual backup and recovery, 
> > > >  you get blazing-fast, flexible, and affordable data protection.
> > > >  Download your free trial now. 
> > > > http://p.sf.net/sfu/quest-d2dcopy1
> > > >  _______________________________________________
> > > >  Geotools-gt2-users mailing list
> > > > [email protected] 
> > > > (mailto:[email protected])
> > > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > > 
> > 
> 
> 
> -- ------------------------------ José Carlos Martínez Llario Producción 
> Cartográfica y SIG Dpto. Ingeniería Cartográfica, Geodesia y Fotogrametría 
> Universidad Politécnica de Valencia E-mail: [email protected] 
> (mailto:[email protected]) Telf: 963877007 ext. 75599 
> ------------------------------ 
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery, 
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now. 
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected] 
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to