Ian,

Thank you very much for the reply. I manually changed the file as you
suggested and it did import successfully.

However, I'm automating this process and so manually changing the file
seems hacky to say the least. I could programmatically read and then
rewrite the file, but it's something I'd like to avoid.

It also seems like the file itself is not inherently an issue, as I can
import it fine into QGIS and display it on an OpenStreetMap with the
correct polygon.

You'll have to excuse my ignorance and newbness to GIS and WKT, I will do
some reading, but perhaps it's also a bug within GeoTools if it can't
handle a file that seems otherwise supported?

Thanks,

William

On Mon, Dec 14, 2015 at 9:11 AM, Ian Turton <[email protected]> wrote:

> It's in the proj file:
>
>
> PROJCS["North_America_Lambert_Conformal_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-215.1425],PARAMETER["Standard_Parallel_1",13.62824074074074],PARAMETER["Standard_Parallel_2",13.66064814814815],PARAMETER["Latitude_Of_Origin",40.0],UNIT["Meter",1.0]]
>
> Try changing the central meridian line to 144.8575 and see if that works
> better.
>
> I'll leave it to others better versed in the intricacies of the WKT Proj
> format to discuss if -215 is legal.
>
> Ian
>
> On 14 December 2015 at 13:18, William Bowen <[email protected]>
> wrote:
>
>> Hello,
>>
>> I've done quite a bit of searching and haven't been able to find anyone
>> who solved this issue, so I'm hoping someone here can help.
>>
>> I'm using gt-shapefile 14.0.
>>
>> I have a series of ESRI shape files and only one in the whole batch is
>> causing failure. I'm downloading the shape file (and its associated prj,
>> etc.) from here:
>>
>> http://tfr.faa.gov/save_pages/5_5245.shp.zip
>>
>> I can open it in QGIS and see the shape over Guam. However, when I
>> perform the following in Scala (shape file path is already extracted and
>> defined):
>>
>> val shapeFile = new File(shapeFilePath)
>> val dataFile = FileDataStoreFinder.getDataStore(shapeFile)
>> val source = dataFile.getFeatureSource
>> val schema = source.getSchema
>>
>> It errors on the last line with the following stack trace:
>>
>> Exception in thread "main"
>> org.opengis.parameter.InvalidParameterValueException: Value -215.143 is out
>> of range [-180..180].
>> at org.geotools.parameter.Parameter.ensureValidValue(Parameter.java:290)
>> at org.geotools.parameter.Parameter.setValue(Parameter.java:620)
>> at org.geotools.referencing.wkt.Parser.parseProjection(Parser.java:625)
>> at org.geotools.referencing.wkt.Parser.parseProjCS(Parser.java:917)
>> at
>> org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:225)
>> at
>> org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:204)
>> at
>> org.geotools.referencing.factory.ReferencingObjectFactory.createFromWKT(ReferencingObjectFactory.java:1090)
>> at org.geotools.data.PrjFileReader.<init>(PrjFileReader.java:94)
>> at org.geotools.data.PrjFileReader.<init>(PrjFileReader.java:68)
>> at
>> org.geotools.data.shapefile.ShapefileSetManager.openPrjReader(ShapefileSetManager.java:106)
>> at
>> org.geotools.data.shapefile.ShapefileFeatureSource.readAttributes(ShapefileFeatureSource.java:516)
>> at
>> org.geotools.data.shapefile.ShapefileFeatureSource.buildFeatureType(ShapefileFeatureSource.java:472)
>> at
>> org.geotools.data.shapefile.ShapefileFeatureStore.buildFeatureType(ShapefileFeatureStore.java:131)
>> at
>> org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:343)
>> at
>> org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:312)
>> at
>> org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:112)
>>
>> It's obviously telling me that it thinks it found a long out of range,
>> but I'm able to load and map the ShapeFile in other programs.
>>
>> Any advice on this?
>>
>> Thanks for reading!
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> GeoTools-GT2-Users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>
>
> --
> Ian Turton
>
------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to