Hi, Json datatypes http://www.tutorialspoint.com/json/json_data_types.htm do not map perfectly with OJ datatypes. Strings can be separated from numbers, though, but there is another problem in missing schema. Each feature can have different attributes.
I believe that GDAL is scanning the GeoJSON file twice for finding all the attributes which appear in the data and analyzing their datatypes. Rather often GeoJSON is converted from GIS data and then schema is fixed so that all features have same set of attributes and empty ones are marked as NULL. Still it is hard to know the type of attribute if it is NULL. Code for reading GeoJSON with GeoTools is at https://github.com/geotools/geotools/tree/master/modules/unsupported/geojson An easy start could be to read the first one feature and build schema with attribute types double, string, boolean. But what to do if there are null values? Read first hundred? Read until first not null? Or let user make a header line with schema into a separate file "basename.jsont" like with the GDAL CSV driver http://www.gdal.org/drv_csv.html attr_1:string;attr_2:integer;attr_3:double Sorry that I can't give simple answers, I thought it would be easier and handled by JTS already. -Jukka- edgar.sol...@web.de kirjoitti 2016-06-26 17:19: > hey Jukka, > > attributes do not seem to carry a type in GeoJSON.. any idea how this > is supposed to be parsed? > > ..ede > > On 23.06.2016 16:20, Jukka Rahkonen wrote: >> Hi Ede, >> >> Please find attached. I included some small samples in both JML and >> GeoJSON. For the conversion I used ogr2ogr: >> >> ogr2ogr -f geojson output.json input.jml >> >> Test data is not perfect: >> >> - I just digitized some features and they may be outside the real area >> of the EPSG:4326 which is default in GeoJSON (-90,-180,90,180) >> - GDAL warned that DateTime type is not natively supported >> >> For handling projections with ogr2ogr use source and target srs >> parameters as >> >> ogr2ogr -f geojson -s_srs epsg:3067 -t_srs epsg:4326 output.json >> input.jml >> >> -Jukka- >> >> edgar.sol...@web.de kirjoitti 2016-06-23 15:56: >>> Jukka, >>> >>> do you have an example dataset to tiner with for me? >>> >>> ..ede ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel