bouviervj / topojson-j

Topojson library for Java, based on topojson specifications.
http://bouviervj.github.io/topojson-j/web/
Apache License 2.0
13 stars 6 forks source link

CSV Reader not working #5

Open heinzwilli opened 9 years ago

heinzwilli commented 9 years ago

Hi, in your commit "Better management for color management, update for csv management" you changed the CSVReader. In src/json/converter/csv/CSVReader.java function readRecord() you changed

boolean filter = (prop!=null?applyFilter(aRecordNumber,prop):true); 

to

boolean filter = (prop!=null?applyFilter(aRecordNumber,prop):false);

this caused the function

TopojsonApi.shpToTopojsonFile("./data/MA.shp", "nad83:2001",
                    "./web/topojson_10.json", 
                    "MA", 
                    10, 
                    4, 
                    false);

to skip reading all the records.

bouviervj commented 9 years ago

Yes, sorry about that , if I recall well , you should have a dbf file associated with the shp file that maps record # to data. This is what defines prop field. In fact the code you highlight is in ShpFileReader.java . I have set the value to false to optimize the parsing of big shp files. As you can merge associated data (dbf content) with csv files, you can have a subset of record # to filter shape records from the shape file. This can be used to filter element that have no prop on large files. Let me know if your usage of this method relies only on shp file, meaning you'll never have the dbf attached file, so that I will try to figure out how to bypass this in defining this boolean.

heinzwilli commented 9 years ago

I only had a .shp file and no .dbf file. Your test shapefile "./data/MA.shp" which has no .dbf file isn't working, too.

bouviervj commented 9 years ago

Should be solved with this commit . let me know