I know the DBF format has issues with UTF-8 encoding. Maybe there are issues 
with longs as well?

A


> On Jan 4, 2015, at 5:31 PM, Marc Le Bihan <[email protected]> wrote:
> 
> Corrected a little thing
> DECIMAL (1,0) to (9,0) map to an Integer
> DECIMAL (10,0) to (18,0) map to a Long
> other DECIMAL map to a Double.
> 
> But the problem remain the same : Long is rejected.
> 
> -----Message d'origine----- From: Marc Le Bihan
> Sent: Sunday, January 04, 2015 11:17 PM
> To: [email protected]
> Subject: Re: Shapefile checkings
> 
> I encounter a problem, I don't know how to resolve it.
> 
> The shapefile SignedBikeRoute_4326_clipped.dbf begins with these fields :
> Field name : OBJECTID, Type : Number, Field length : 10, Decimal positions :
> 0
> Field name : FNODE_, Type : Number, Field length : 10, Decimal positions : 0
> Field name : TNODE_, Type : Number, Field length : 10, Decimal positions : 0
> Field name : LPOLY_, Type : Number, Field length : 10, Decimal positions : 0
> 
> OBJECTID DECIMAL(10,0) is mapped as a Double with ResultSet:getObject()
> 
> and I receive this exception during the tests, now that I really create a
> feature...
> 
> java.lang.ClassCastException: La propriété OBJECTID n'accepte pas les
> valeurs de type Double.
> (the property OBJECTID doesn't accept the value of Double type)
>       at
> org.apache.sis.feature.AbstractFeature.illegalValueClass(AbstractFeature.java:528)
>       at
> org.apache.sis.feature.AbstractFeature.verifyAttributeValue(AbstractFeature.java:447)
>       at
> org.apache.sis.feature.AbstractFeature.verifyPropertyValue(AbstractFeature.java:417)
>       at
> org.apache.sis.feature.DenseFeature.setPropertyValue(DenseFeature.java:206)
>       at
> org.apache.sis.storage.shapefile.InputFeatureStream.readFeature(InputFeatureStream.java:161)
>       at
> org.apache.sis.storage.shapefile.ShapeFileTest.readAll(ShapeFileTest.java:92)
>       at
> org.apache.sis.storage.shapefile.ShapeFileTest.testPolyineCount(ShapeFileTest.java:57)
> 
> I have to do something.
> Either :
> 1) Find a way to declare the feature description to fit the database. How
> does the AbstractFeature class works ?
> 2) Put every value in String format, as it was done before, but it seems to
> me to be a bad idea, especially for dates.
> 
> Marc.
> 
> -----Message d'origine----- From: Adam Estrada
> Sent: Sunday, January 04, 2015 11:02 PM
> To: [email protected]
> Subject: Re: Shapefile checkings
> 
> :) Thanks for fixing this bug quickly, Marc!
> 
> Adam
> 
> 
> 
>> On Jan 4, 2015, at 4:53 PM, Marc Le Bihan <[email protected]> wrote:
>> 
>> Humm. It appears I left a nice bug that I have to correct immediately. 
>> Shapefile are no more returning features (!!!).
>> Sorry.
>> 
>> From: Marc Le Bihan
>> Sent: Sunday, January 04, 2015 10:04 PM
>> To: [email protected]
>> Subject: Shapefile checkings
>> 
>> Hello,
>> 
>>   I committed a change that links more the Shapefile files to the DBase file.
>> 
>>   The Shapefile class could disappear. The way to read Features from a 
>> shapefile is now :
>> 
>>   InputFeatureStream is = new InputFeatureStream(shapeFile, databaseFile);  
>> // Shapefile (.shp) and Database (.dbf) files.
>>   Feature feature = is.readFeature(); // null is returned when the end of 
>> the shapefile / database are reached.
>> 
>>   Inside the map of the Feature, the objects values have now the SQL type 
>> associated to their type : Date, Integer, Double, Float or String.
>> 
>>   I expect it works. Regarding to the test units available it doesn’t cause 
>> troubles, but... these tests are not checking deeply the problems that can 
>> exist.
>>   1) What control can I do on values red on shapefile (not the database 
>> part, but the shapefile part) to ensure that I am not reading stupid things ?
>>   2) Can we guess Shapefile entry #4 = Record #4 in the Database ? BTW, I 
>> will add a new constructor to InputFeatureStream that will have an SQL 
>> request of the form “SELECT * FROM <database> WHERE <single condition>“ to 
>> limit Feature to a database condition.
>>   3) Deleted records are still not taken into account in Database. If they 
>> came, the record should be skept (but isn’t yet). I hope that when this 
>> happens there is no Shapefile entry associated to this deleted record.
>> 
>>   4) Shall I put all the exceptions in a public package instead of their 
>> internal package ? I think it would be better.
>> 
>> Regards,
>> 
>> Marc Le Bihan
> 

Reply via email to