wavded / ogre

ogr2ogr geojson-focused web client
http://ogre.adc4gis.com
MIT License
266 stars 79 forks source link

Properties not split up #20

Closed nuest closed 10 years ago

nuest commented 11 years ago

I successfully converted a JSON track (e.g. https://envirocar.org/api/stable/tracks/52714d4ee4b000fe0582a292) from enviroCar with your great website!

However, all the observed properties are in one column when I open the shapefile in QGis. Is this an issue with the GeoJSON file that is put in, or a problem of the conversion?

Input JSON snippet

"properties": {
    "id": "52714d4ee4b000fe0582a294",
    "time": "2013-10-18T09:29:48Z",
    "phenomenons": { … }
}

Thanks for your help!

wavded commented 11 years ago

Interesting how the GeoJSON source has nested properties, not sure how ogr2ogr would handle that since Shapefiles are a flat tabular structure (DBF). Taking a peek and will let you know if I come up with anything.

wavded commented 11 years ago

Ahh yes. Since the phenomenon field is a nested structure in the JSON, ogr2ogr just flattens that out into a single column with JSON data. I don't see any options to change that behavior: http://www.gdal.org/ogr/drv_geojson.html

nuest commented 11 years ago

Right - thanks for checking! I'm not an expert in ogr2ogr :-). We'll take a look into the problem on our end (https://github.com/enviroCar/enviroCar-server/issues/144) and see if we can change the JSON structure or if we have to implement the conversion ourselves.

Thanks for your help!

wavded commented 11 years ago

OK sounds good, maybe a process that flattens those field names? e.g.

"phenomenons-Speed-value": 41, "phenomenons-Speed-unit": "km/h"

If its a common enough thing I would consider adding it to Ogre.

nuest commented 11 years ago

I just now found out we already have a webservice that does a conversion to shapefile (and probably manually maps the attributes), so sorry for taking your time - I'll keep this project in mind though, you never know.

I'll also bring up the topic of your attribute datamodel - seems like we're not following the usual practices here...