Skip to content

Commit

Permalink
issue #17 refine geojson conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Oct 3, 2014
1 parent 6b1d474 commit 6ead5a4
Show file tree
Hide file tree
Showing 5 changed files with 618 additions and 526 deletions.
8 changes: 7 additions & 1 deletion examples/basics/11_formatconvert/etl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ file_path = output/building-dutch.json
class = inputs.fileinput.XmlFileInput
file_path = input/cities.gml

# The GML must be a simple features collection
[convert_to_geojson]
class = filters.formatconverter.FormatConverter
input_format = etree_doc
output_format = struct
output_format = geojson_collection
converter_args = {
'root_tag': 'FeatureCollection',
'feature_tag': 'featureMember',
'feature_id_attr': 'fid'
}

[output_geojson_file]
class = outputs.fileoutput.FileOutput
Expand Down
235 changes: 119 additions & 116 deletions examples/basics/11_formatconvert/output/cities-gjson.json
Original file line number Diff line number Diff line change
@@ -1,122 +1,125 @@
{
"FeatureCollection": {
"schemaLocation": "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",
"featureMember": [
{
"heronfeat": {
"STATUS": "Provincial capital",
"ObjectID": "12386304",
"geometry": {
"type": "Point",
"coordinates": [
4.632,
52.387
]
},
"POP_RANK": "5",
"GMI_ADMIN": "NLD-NHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Noord-Holland",
"LABEL_FLAG": "0",
"fid": "cities.1358",
"CITY_NAME": "Haarlem",
"POP_CLASS": "100,000 to 250,000",
"PORT_ID": "0",
"FIPS_CNTRY": "NL"
}
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
4.632,
52.387
]
},
{
"heronfeat": {
"STATUS": "National capital",
"ObjectID": "12386305",
"geometry": {
"type": "Point",
"coordinates": [
4.89483636,
52.37304545
]
},
"POP_RANK": "3",
"GMI_ADMIN": "NLD-NHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Noord-Holland",
"LABEL_FLAG": "0",
"fid": "cities.1359",
"CITY_NAME": "Amsterdam",
"POP_CLASS": "500,000 to 1,000,000",
"PORT_ID": "31060",
"FIPS_CNTRY": "NL"
}
"type": "feature",
"properties": {
"STATUS": "Provincial capital",
"ObjectID": "12386304",
"POP_RANK": "5",
"GMI_ADMIN": "NLD-NHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Noord-Holland",
"LABEL_FLAG": "0",
"CITY_NAME": "Haarlem",
"POP_CLASS": "100,000 to 250,000",
"PORT_ID": "0",
"FIPS_CNTRY": "NL"
},
{
"heronfeat": {
"STATUS": "Provincial capital",
"ObjectID": "12386306",
"geometry": {
"type": "Point",
"coordinates": [
5.112,
52.1
]
},
"POP_RANK": "5",
"GMI_ADMIN": "NLD-UTR",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Utrecht",
"LABEL_FLAG": "1",
"fid": "cities.1360",
"CITY_NAME": "Utrecht",
"POP_CLASS": "100,000 to 250,000",
"PORT_ID": "0",
"FIPS_CNTRY": "NL"
}
"id": "cities.1358"
},
{
"geometry": {
"type": "Point",
"coordinates": [
4.89483636,
52.37304545
]
},
{
"heronfeat": {
"STATUS": "Provincial capital",
"ObjectID": "12386307",
"geometry": {
"type": "Point",
"coordinates": [
4.281,
52.076
]
},
"POP_RANK": "4",
"GMI_ADMIN": "NLD-ZHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Zuid-Holland",
"LABEL_FLAG": "0",
"fid": "cities.1361",
"CITY_NAME": "The Hague",
"POP_CLASS": "250,000 to 500,000",
"PORT_ID": "0",
"FIPS_CNTRY": "NL"
}
"type": "feature",
"properties": {
"STATUS": "National capital",
"ObjectID": "12386305",
"POP_RANK": "3",
"GMI_ADMIN": "NLD-NHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Noord-Holland",
"LABEL_FLAG": "0",
"CITY_NAME": "Amsterdam",
"POP_CLASS": "500,000 to 1,000,000",
"PORT_ID": "31060",
"FIPS_CNTRY": "NL"
},
{
"heronfeat": {
"STATUS": "Other",
"ObjectID": "12386308",
"geometry": {
"type": "Point",
"coordinates": [
4.48515455,
51.92559091
]
},
"POP_RANK": "2",
"GMI_ADMIN": "NLD-ZHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Zuid-Holland",
"LABEL_FLAG": "0",
"fid": "cities.1362",
"CITY_NAME": "Rotterdam",
"POP_CLASS": "1,000,000 to 5,000,000",
"PORT_ID": "31140",
"FIPS_CNTRY": "NL"
}
}
]
}
"id": "cities.1359"
},
{
"geometry": {
"type": "Point",
"coordinates": [
5.112,
52.1
]
},
"type": "feature",
"properties": {
"STATUS": "Provincial capital",
"ObjectID": "12386306",
"POP_RANK": "5",
"GMI_ADMIN": "NLD-UTR",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Utrecht",
"LABEL_FLAG": "1",
"CITY_NAME": "Utrecht",
"POP_CLASS": "100,000 to 250,000",
"PORT_ID": "0",
"FIPS_CNTRY": "NL"
},
"id": "cities.1360"
},
{
"geometry": {
"type": "Point",
"coordinates": [
4.281,
52.076
]
},
"type": "feature",
"properties": {
"STATUS": "Provincial capital",
"ObjectID": "12386307",
"POP_RANK": "4",
"GMI_ADMIN": "NLD-ZHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Zuid-Holland",
"LABEL_FLAG": "0",
"CITY_NAME": "The Hague",
"POP_CLASS": "250,000 to 500,000",
"PORT_ID": "0",
"FIPS_CNTRY": "NL"
},
"id": "cities.1361"
},
{
"geometry": {
"type": "Point",
"coordinates": [
4.48515455,
51.92559091
]
},
"type": "feature",
"properties": {
"STATUS": "Other",
"ObjectID": "12386308",
"POP_RANK": "2",
"GMI_ADMIN": "NLD-ZHL",
"CNTRY_NAME": "Netherlands",
"ADMIN_NAME": "Zuid-Holland",
"LABEL_FLAG": "0",
"CITY_NAME": "Rotterdam",
"POP_CLASS": "1,000,000 to 5,000,000",
"PORT_ID": "31140",
"FIPS_CNTRY": "NL"
},
"id": "cities.1362"
}
]
}
Loading

0 comments on commit 6ead5a4

Please sign in to comment.