CRS detection is provided by the "PRJ" sidecar file. If it is present then
GeoTools can read the file and parse a CoordinateReferenceSystem object out.

If it is not present you can either set it manually (GeoTools will write
out the PRJ file), or in cases where the PRJ file is missing/wrong you can
force a CRS as part of your Query.

Jody Garnett


On Wed, Feb 26, 2014 at 8:35 AM, Thomas Evans <thomasjevan...@gmail.com>wrote:

> Thanks for clarifying the terminology Frank.  I have 6 Shapefiles all
> located in the same directory with the accompanying sidecar files there as
> well, is there anything else required to "operate on the as a group"?.
> Can anyone explain how the CRS is detected when using the
> ShapefileDataStore, or if I always need to manually set it?
>
>
> On Mon, Feb 24, 2014 at 9:30 PM, Frank van der Hulst <
> drifter.fr...@gmail.com> wrote:
>
>> The term "Shapefile" does not refer just to the .SHP file, but also to
>> all the other files with the same name (.dbf, .prj. etc). These files
>> should always be operated on as a group.
>>
>>
>>
>> On Tue, Feb 25, 2014 at 2:32 PM, Thomas Evans 
>> <thomasjevan...@gmail.com>wrote:
>>
>>> Hi List,
>>>
>>> This is my first experience with GISData and GeoTools.  I am trying to
>>> use the ShapefileDataStore(URL url) to load up a handful of shape files
>>> into my Geography.  The schema and AttributeType of the GeometryTypeImpl
>>> that are created during the ShapefileDataStore construction both contain a
>>> null CRS.  I believe this info is usually loaded from the .prj file that is
>>> located in the same directory with the same filename of the .shp file.
>>>  Does anyone know of any gotchas here?
>>>
>>> Code -
>>> URL url = data.getFile().toURI().toURL();
>>> ShapefileDataStore store = new ShapefileDataStore(url);
>>> SimpleFeatureType schema = store.getSchema(store.getTypeNames()[0]);
>>> // First attribute at index 0 is always the Geometry
>>> AttributeType type = schema.getType(0);
>>> CoordinateReferenceSystem dataCRS = ((GeometryType)
>>> type).getCoordinateReferenceSystem(); <-- Returns null
>>>
>>> schema.toString() -
>>> SimpleFeatureTypeImpl
>>> http://www.opengis.net/gml:SoCALbg2010_TRTP_Extent_DATA_NUMBERSidentified 
>>> extends
>>> polygonFeature(the_geom:MultiPolygon,OBJECTID:OBJECTID,GEOID10:GEOID10,Shape_Leng:Shape_Leng,Shape_Area:Shape_Area,STATEP10_N:STATEP10_N,COUNTRYFP1:COUNTRYFP1,TRACTCE10_:TRACTCE10_,BLKGRPCE10:BLKGRPCE10,GEOID10_NO:GEOID10_NO,INTPLAT10_:INTPLAT10_,INTPLTON10:INTPLTON10,BLKGRP_NAM:BLKGRP_NAM,POP_TOTAL_:POP_TOTAL_,HHI_MEDIAN:HHI_MEDIAN,NOSCHOOL_N:NOSCHOOL_N,NOGED_NO:NOGED_NO,GED_NO:GED_NO,SOMEGOLLEG:SOMEGOLLEG,ASSOCIATE_:ASSOCIATE_,BACHELOR_N:BACHELOR_N,MASTER_NO:MASTER_NO,PROFESSION:PROFESSION,DOCTORATE_:DOCTORATE_,EDUCATION_:EDUCATION_,INCOME_NO:INCOME_NO,POWER_NO:POWER_NO,ALAND10_NO:ALAND10_NO,AWATER10_N:AWATER10_N,AREA_SQMI_:AREA_SQMI_,DENSITY_SQ:DENSITY_SQ)
>>>
>>> type.toString() -
>>> GeometryTypeImpl MultiPolygon<MultiPolygon>
>>>
>>> prj file content -
>>>
>>> PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Robinson"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0]]
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Flow-based real-time traffic analytics software. Cisco certified tool.
>>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>>> Customize your own dashboards, set traffic alerts and generate reports.
>>> Network behavioral analysis & security monitoring. All-in-one tool.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> GeoTools-GT2-Users mailing list
>>> GeoTools-GT2-Users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to