from geometrycollection to polygon geometry with pythonOGR - Weird GeomType -2147483645 on polygon...
Was Claire Dearing blamed for any of Jurassic World's failings?
What species should be used for storage of human minds?
How can find the 2D Voronoi cell area distribution?
Why is it that Bernie Sanders is always called a "socialist"?
Critique vs nitpicking
XOR-free sets: Maximum density?
Is .NET Framework 3.5 still needed with a SQL Server 2017 installation to utilize Database Mail?
Why is Shelob considered evil?
"I showed the monkey himself in the mirror". Why is this sentence grammatical?
What's the reason that we have a different number of days each month?
Growth of Mordell-Weil Rank of Elliptic Curves over Field Extensions
Writing dialogues for characters whose first language is not English
If I tried and failed to start my own business, how do I apply for a job without job experience?
Insecure private-key encryption
Why did Ylvis use "go" instead of "say" in phrases like "Dog goes 'woof'"?
"Starve to death" Vs. "Starve to the point of death"
When using Volatility with a memory image, what is the Kernel version?
What is an efficient way to digitize a family photo collection?
Does it take energy to move something in a circle?
Renting a 2CV in France
How to fly a direct entry holding pattern when approaching from an awkward angle?
How can I handle players killing my NPC outside of combat?
Why do neural networks need so many examples to perform?
RS485 using USART or UART port on STM32
from geometrycollection to polygon geometry with python
OGR - Weird GeomType -2147483645 on polygon shapefileLoading GEOJSON in Leaflet and separating attributesogr2ogr: Convert geojson to shapefile - additional features?GeoJSON MultiPolygon/Polygon to PostgreSQL using Python/Psycopg2Parse .geojson file in RWorking with GeometryCollection in Leaflet layerQGIS Python Program for extracting all the Polygon nodes - Issue with Geometry MULTIPOLYGONLeaflet L.geoJSON from a js variable geojson object not showing on mapHow to append geojson file using featureselectionCan't set OGR layer geometry type in Python
I have a geojson file containing a feature with geometrycollection type (polygon and linestring).
I need to produce two ESRI Shapefile from the geojson geometrycollection: one with Polygon only and a second with Linestring only.
The code must be written in python.
There is any solution?
I met another problem in the "from geojson to shapefile" process.
My geojson file include some features with geometrytype = MultiPolygon.
These MultiPolygon are constructed in such a way that the first element includes the following elements and these never intersect.
I enclose a picture , showing the geojson file opened into QGIS, that clarifies the situation:
When I use the ogr2ogr
to convert geojson to shapefile I obtain the following result, shown in the following figure:
There is an ogr2ogr
function allowing to explode the multipolygon into polygon?
I can't use the QGIS ftools "from multi parts to single parts" because I must have the instance of python I use to develop separeted from the QGIS folder.
I try with fiona, shapely and json:
with fiona.open(settings.L_json, 'r') as data_file:
data = json.load(data_file)
for f in data_file:
next = f.next()
multipol = shape(next['type']['geometry']['properties'])
for poly in multipol:
feature = {}
feature['type'] = poly['type']
feature['geometry']['type'] = 'Polygon'
feature['geometry']['coordinates'] = poly['geometry']['coordinates']
feature['properties'] = poly['properties']
data['features'].append(feature)
if settings.L_json['*L_*']:
with open('G:\geojson\geojson_Rep\LOW_'+settings.now+'.geo.json', 'w') as f:
f.write(json.dumps(data))
but it does not work.
Any simplest solution? ogr2ogr
can do it? It is ok also obtaining from the first geojson other geojson splitting the multipolygon geometry.
Simplifying, I need to get n polygon from a multipolygon with n elements, in one of the following formats: .geo.json, .shp, .wkt.
Any hint?
Here my solution:
with fiona.open(input, 'r') as source:
count = 0
for f in source:
c = f['geometry']['coordinates']
if count == 0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_MEDIUM.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
elif count >0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_TOP'+str(count)+'.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
count +=1
Anyone has some other solution or hint (also performing the if-elif
cycle)?
python gdal geojson geometrycollection
|
show 1 more comment
I have a geojson file containing a feature with geometrycollection type (polygon and linestring).
I need to produce two ESRI Shapefile from the geojson geometrycollection: one with Polygon only and a second with Linestring only.
The code must be written in python.
There is any solution?
I met another problem in the "from geojson to shapefile" process.
My geojson file include some features with geometrytype = MultiPolygon.
These MultiPolygon are constructed in such a way that the first element includes the following elements and these never intersect.
I enclose a picture , showing the geojson file opened into QGIS, that clarifies the situation:
When I use the ogr2ogr
to convert geojson to shapefile I obtain the following result, shown in the following figure:
There is an ogr2ogr
function allowing to explode the multipolygon into polygon?
I can't use the QGIS ftools "from multi parts to single parts" because I must have the instance of python I use to develop separeted from the QGIS folder.
I try with fiona, shapely and json:
with fiona.open(settings.L_json, 'r') as data_file:
data = json.load(data_file)
for f in data_file:
next = f.next()
multipol = shape(next['type']['geometry']['properties'])
for poly in multipol:
feature = {}
feature['type'] = poly['type']
feature['geometry']['type'] = 'Polygon'
feature['geometry']['coordinates'] = poly['geometry']['coordinates']
feature['properties'] = poly['properties']
data['features'].append(feature)
if settings.L_json['*L_*']:
with open('G:\geojson\geojson_Rep\LOW_'+settings.now+'.geo.json', 'w') as f:
f.write(json.dumps(data))
but it does not work.
Any simplest solution? ogr2ogr
can do it? It is ok also obtaining from the first geojson other geojson splitting the multipolygon geometry.
Simplifying, I need to get n polygon from a multipolygon with n elements, in one of the following formats: .geo.json, .shp, .wkt.
Any hint?
Here my solution:
with fiona.open(input, 'r') as source:
count = 0
for f in source:
c = f['geometry']['coordinates']
if count == 0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_MEDIUM.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
elif count >0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_TOP'+str(count)+'.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
count +=1
Anyone has some other solution or hint (also performing the if-elif
cycle)?
python gdal geojson geometrycollection
Here on GIS Stack, we usually don't write the code for you, instead we like to help you when your code isn't working. So try to write something on your own and reform your question. PS: Some general links to help you with parsing json files in python -> stackoverflow.com/questions/2835559/… and resources.arcgis.com/en/help/main/10.1/index.html#/… will help you with exporting to shapefiles and also pro.arcgis.com/en/pro-app/tool-reference/data-management/…
– Piskr
Sep 28 '16 at 10:25
I'm sorry. I do not need the code but just an hint about some module or function. In fact, I was hoping there was a module for managing geojson files that can help me to solve the problem subject of my question, directly or also indirectly.
– lorenzo
Sep 28 '16 at 10:29
My hint is to use GDAL with SQLite SQL dialect and SpatiaLite functions, explode GeometryCollection to elementary geometries and then filter by geometry type.
– user30184
Sep 28 '16 at 11:06
1
I solved using {gdal -f geojson -dialect sqlite -mapFiledType Date=String,Time=String -sql "SELECT * FROM OGRGeoJSON WHERE GeometryType(geometry)='MULTPOLIGON'" output.geo.json input.geo.json}. The following step is to convert this geojson to a shpefile. I use ogr2ogr function and it works very well. Just a question: all features have properties with the UTC date expressed into the ISO-8601 format (yyyy-mm-ddThh:mm:ss.xxxZ). ESRI Shapefile driver does not recognize this format. I would store this properties into an attribute (string format). Any hint? Thanks
– lorenzo
Sep 29 '16 at 12:33
i just wrote a script that converts GeoJSON to a feature class, would that be of anyhelp. you can just add the arcpy.FeatureClassToShapefile_conversion() and you would be good to go
– ziggy
Sep 30 '16 at 15:42
|
show 1 more comment
I have a geojson file containing a feature with geometrycollection type (polygon and linestring).
I need to produce two ESRI Shapefile from the geojson geometrycollection: one with Polygon only and a second with Linestring only.
The code must be written in python.
There is any solution?
I met another problem in the "from geojson to shapefile" process.
My geojson file include some features with geometrytype = MultiPolygon.
These MultiPolygon are constructed in such a way that the first element includes the following elements and these never intersect.
I enclose a picture , showing the geojson file opened into QGIS, that clarifies the situation:
When I use the ogr2ogr
to convert geojson to shapefile I obtain the following result, shown in the following figure:
There is an ogr2ogr
function allowing to explode the multipolygon into polygon?
I can't use the QGIS ftools "from multi parts to single parts" because I must have the instance of python I use to develop separeted from the QGIS folder.
I try with fiona, shapely and json:
with fiona.open(settings.L_json, 'r') as data_file:
data = json.load(data_file)
for f in data_file:
next = f.next()
multipol = shape(next['type']['geometry']['properties'])
for poly in multipol:
feature = {}
feature['type'] = poly['type']
feature['geometry']['type'] = 'Polygon'
feature['geometry']['coordinates'] = poly['geometry']['coordinates']
feature['properties'] = poly['properties']
data['features'].append(feature)
if settings.L_json['*L_*']:
with open('G:\geojson\geojson_Rep\LOW_'+settings.now+'.geo.json', 'w') as f:
f.write(json.dumps(data))
but it does not work.
Any simplest solution? ogr2ogr
can do it? It is ok also obtaining from the first geojson other geojson splitting the multipolygon geometry.
Simplifying, I need to get n polygon from a multipolygon with n elements, in one of the following formats: .geo.json, .shp, .wkt.
Any hint?
Here my solution:
with fiona.open(input, 'r') as source:
count = 0
for f in source:
c = f['geometry']['coordinates']
if count == 0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_MEDIUM.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
elif count >0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_TOP'+str(count)+'.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
count +=1
Anyone has some other solution or hint (also performing the if-elif
cycle)?
python gdal geojson geometrycollection
I have a geojson file containing a feature with geometrycollection type (polygon and linestring).
I need to produce two ESRI Shapefile from the geojson geometrycollection: one with Polygon only and a second with Linestring only.
The code must be written in python.
There is any solution?
I met another problem in the "from geojson to shapefile" process.
My geojson file include some features with geometrytype = MultiPolygon.
These MultiPolygon are constructed in such a way that the first element includes the following elements and these never intersect.
I enclose a picture , showing the geojson file opened into QGIS, that clarifies the situation:
When I use the ogr2ogr
to convert geojson to shapefile I obtain the following result, shown in the following figure:
There is an ogr2ogr
function allowing to explode the multipolygon into polygon?
I can't use the QGIS ftools "from multi parts to single parts" because I must have the instance of python I use to develop separeted from the QGIS folder.
I try with fiona, shapely and json:
with fiona.open(settings.L_json, 'r') as data_file:
data = json.load(data_file)
for f in data_file:
next = f.next()
multipol = shape(next['type']['geometry']['properties'])
for poly in multipol:
feature = {}
feature['type'] = poly['type']
feature['geometry']['type'] = 'Polygon'
feature['geometry']['coordinates'] = poly['geometry']['coordinates']
feature['properties'] = poly['properties']
data['features'].append(feature)
if settings.L_json['*L_*']:
with open('G:\geojson\geojson_Rep\LOW_'+settings.now+'.geo.json', 'w') as f:
f.write(json.dumps(data))
but it does not work.
Any simplest solution? ogr2ogr
can do it? It is ok also obtaining from the first geojson other geojson splitting the multipolygon geometry.
Simplifying, I need to get n polygon from a multipolygon with n elements, in one of the following formats: .geo.json, .shp, .wkt.
Any hint?
Here my solution:
with fiona.open(input, 'r') as source:
count = 0
for f in source:
c = f['geometry']['coordinates']
if count == 0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_MEDIUM.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
elif count >0:
outputfile = 'G:\SVN EO\Python\Utility\geojson\tmp\mondometeo_20160930_145814_TOP'+str(count)+'.geo.json'
with fiona.open(outputfile, 'w', driver=source.driver, schema=source.schema) as output:
output.write({
"type": f['type'],
"geometry": {"type": "Polygon", "coordinates": c[count]},
"properties": f['properties']})
return outputfile
count +=1
Anyone has some other solution or hint (also performing the if-elif
cycle)?
python gdal geojson geometrycollection
python gdal geojson geometrycollection
edited 15 mins ago
Jochen Schwarze
6,49031857
6,49031857
asked Sep 28 '16 at 9:35
lorenzolorenzo
315
315
Here on GIS Stack, we usually don't write the code for you, instead we like to help you when your code isn't working. So try to write something on your own and reform your question. PS: Some general links to help you with parsing json files in python -> stackoverflow.com/questions/2835559/… and resources.arcgis.com/en/help/main/10.1/index.html#/… will help you with exporting to shapefiles and also pro.arcgis.com/en/pro-app/tool-reference/data-management/…
– Piskr
Sep 28 '16 at 10:25
I'm sorry. I do not need the code but just an hint about some module or function. In fact, I was hoping there was a module for managing geojson files that can help me to solve the problem subject of my question, directly or also indirectly.
– lorenzo
Sep 28 '16 at 10:29
My hint is to use GDAL with SQLite SQL dialect and SpatiaLite functions, explode GeometryCollection to elementary geometries and then filter by geometry type.
– user30184
Sep 28 '16 at 11:06
1
I solved using {gdal -f geojson -dialect sqlite -mapFiledType Date=String,Time=String -sql "SELECT * FROM OGRGeoJSON WHERE GeometryType(geometry)='MULTPOLIGON'" output.geo.json input.geo.json}. The following step is to convert this geojson to a shpefile. I use ogr2ogr function and it works very well. Just a question: all features have properties with the UTC date expressed into the ISO-8601 format (yyyy-mm-ddThh:mm:ss.xxxZ). ESRI Shapefile driver does not recognize this format. I would store this properties into an attribute (string format). Any hint? Thanks
– lorenzo
Sep 29 '16 at 12:33
i just wrote a script that converts GeoJSON to a feature class, would that be of anyhelp. you can just add the arcpy.FeatureClassToShapefile_conversion() and you would be good to go
– ziggy
Sep 30 '16 at 15:42
|
show 1 more comment
Here on GIS Stack, we usually don't write the code for you, instead we like to help you when your code isn't working. So try to write something on your own and reform your question. PS: Some general links to help you with parsing json files in python -> stackoverflow.com/questions/2835559/… and resources.arcgis.com/en/help/main/10.1/index.html#/… will help you with exporting to shapefiles and also pro.arcgis.com/en/pro-app/tool-reference/data-management/…
– Piskr
Sep 28 '16 at 10:25
I'm sorry. I do not need the code but just an hint about some module or function. In fact, I was hoping there was a module for managing geojson files that can help me to solve the problem subject of my question, directly or also indirectly.
– lorenzo
Sep 28 '16 at 10:29
My hint is to use GDAL with SQLite SQL dialect and SpatiaLite functions, explode GeometryCollection to elementary geometries and then filter by geometry type.
– user30184
Sep 28 '16 at 11:06
1
I solved using {gdal -f geojson -dialect sqlite -mapFiledType Date=String,Time=String -sql "SELECT * FROM OGRGeoJSON WHERE GeometryType(geometry)='MULTPOLIGON'" output.geo.json input.geo.json}. The following step is to convert this geojson to a shpefile. I use ogr2ogr function and it works very well. Just a question: all features have properties with the UTC date expressed into the ISO-8601 format (yyyy-mm-ddThh:mm:ss.xxxZ). ESRI Shapefile driver does not recognize this format. I would store this properties into an attribute (string format). Any hint? Thanks
– lorenzo
Sep 29 '16 at 12:33
i just wrote a script that converts GeoJSON to a feature class, would that be of anyhelp. you can just add the arcpy.FeatureClassToShapefile_conversion() and you would be good to go
– ziggy
Sep 30 '16 at 15:42
Here on GIS Stack, we usually don't write the code for you, instead we like to help you when your code isn't working. So try to write something on your own and reform your question. PS: Some general links to help you with parsing json files in python -> stackoverflow.com/questions/2835559/… and resources.arcgis.com/en/help/main/10.1/index.html#/… will help you with exporting to shapefiles and also pro.arcgis.com/en/pro-app/tool-reference/data-management/…
– Piskr
Sep 28 '16 at 10:25
Here on GIS Stack, we usually don't write the code for you, instead we like to help you when your code isn't working. So try to write something on your own and reform your question. PS: Some general links to help you with parsing json files in python -> stackoverflow.com/questions/2835559/… and resources.arcgis.com/en/help/main/10.1/index.html#/… will help you with exporting to shapefiles and also pro.arcgis.com/en/pro-app/tool-reference/data-management/…
– Piskr
Sep 28 '16 at 10:25
I'm sorry. I do not need the code but just an hint about some module or function. In fact, I was hoping there was a module for managing geojson files that can help me to solve the problem subject of my question, directly or also indirectly.
– lorenzo
Sep 28 '16 at 10:29
I'm sorry. I do not need the code but just an hint about some module or function. In fact, I was hoping there was a module for managing geojson files that can help me to solve the problem subject of my question, directly or also indirectly.
– lorenzo
Sep 28 '16 at 10:29
My hint is to use GDAL with SQLite SQL dialect and SpatiaLite functions, explode GeometryCollection to elementary geometries and then filter by geometry type.
– user30184
Sep 28 '16 at 11:06
My hint is to use GDAL with SQLite SQL dialect and SpatiaLite functions, explode GeometryCollection to elementary geometries and then filter by geometry type.
– user30184
Sep 28 '16 at 11:06
1
1
I solved using {gdal -f geojson -dialect sqlite -mapFiledType Date=String,Time=String -sql "SELECT * FROM OGRGeoJSON WHERE GeometryType(geometry)='MULTPOLIGON'" output.geo.json input.geo.json}. The following step is to convert this geojson to a shpefile. I use ogr2ogr function and it works very well. Just a question: all features have properties with the UTC date expressed into the ISO-8601 format (yyyy-mm-ddThh:mm:ss.xxxZ). ESRI Shapefile driver does not recognize this format. I would store this properties into an attribute (string format). Any hint? Thanks
– lorenzo
Sep 29 '16 at 12:33
I solved using {gdal -f geojson -dialect sqlite -mapFiledType Date=String,Time=String -sql "SELECT * FROM OGRGeoJSON WHERE GeometryType(geometry)='MULTPOLIGON'" output.geo.json input.geo.json}. The following step is to convert this geojson to a shpefile. I use ogr2ogr function and it works very well. Just a question: all features have properties with the UTC date expressed into the ISO-8601 format (yyyy-mm-ddThh:mm:ss.xxxZ). ESRI Shapefile driver does not recognize this format. I would store this properties into an attribute (string format). Any hint? Thanks
– lorenzo
Sep 29 '16 at 12:33
i just wrote a script that converts GeoJSON to a feature class, would that be of anyhelp. you can just add the arcpy.FeatureClassToShapefile_conversion() and you would be good to go
– ziggy
Sep 30 '16 at 15:42
i just wrote a script that converts GeoJSON to a feature class, would that be of anyhelp. you can just add the arcpy.FeatureClassToShapefile_conversion() and you would be good to go
– ziggy
Sep 30 '16 at 15:42
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f212242%2ffrom-geometrycollection-to-polygon-geometry-with-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f212242%2ffrom-geometrycollection-to-polygon-geometry-with-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Here on GIS Stack, we usually don't write the code for you, instead we like to help you when your code isn't working. So try to write something on your own and reform your question. PS: Some general links to help you with parsing json files in python -> stackoverflow.com/questions/2835559/… and resources.arcgis.com/en/help/main/10.1/index.html#/… will help you with exporting to shapefiles and also pro.arcgis.com/en/pro-app/tool-reference/data-management/…
– Piskr
Sep 28 '16 at 10:25
I'm sorry. I do not need the code but just an hint about some module or function. In fact, I was hoping there was a module for managing geojson files that can help me to solve the problem subject of my question, directly or also indirectly.
– lorenzo
Sep 28 '16 at 10:29
My hint is to use GDAL with SQLite SQL dialect and SpatiaLite functions, explode GeometryCollection to elementary geometries and then filter by geometry type.
– user30184
Sep 28 '16 at 11:06
1
I solved using {gdal -f geojson -dialect sqlite -mapFiledType Date=String,Time=String -sql "SELECT * FROM OGRGeoJSON WHERE GeometryType(geometry)='MULTPOLIGON'" output.geo.json input.geo.json}. The following step is to convert this geojson to a shpefile. I use ogr2ogr function and it works very well. Just a question: all features have properties with the UTC date expressed into the ISO-8601 format (yyyy-mm-ddThh:mm:ss.xxxZ). ESRI Shapefile driver does not recognize this format. I would store this properties into an attribute (string format). Any hint? Thanks
– lorenzo
Sep 29 '16 at 12:33
i just wrote a script that converts GeoJSON to a feature class, would that be of anyhelp. you can just add the arcpy.FeatureClassToShapefile_conversion() and you would be good to go
– ziggy
Sep 30 '16 at 15:42