1

I'm collecting road accidents from an API through a Python request and getting my response as JSON. The JSON response contains coordinates and general information as below.

{u'RESPONSE': {u'RESULT': [{u'Situation': [{u'Deviation':
[{u'Geometry': {u'WGS84': u'POINT (16.109539 60.9519234)'},
u'MessageCode': u'Tj\xe4lskada', u'IconId': u'frostDamage',
u'RoadNumber': u'V\xe4g 877', u'LocationDescriptor': u'V\xe4g 877 i
Falu kommun i Dalarnas l\xe4n.'}, {u'Geometry': {u'WGS84': u'POINT
(16.109539 60.9519234)'}, u'MessageCode': u'Viktbegr\xe4nsning
g\xe4ller', u'IconId': u'trafficMessage', u'RoadNumber': u'V\xe4g
877'}], u'PublicationTime': u'2019-03-13T19:45:25'}]}]}}

What I want to do is to create a shapefile with the coordinates I have in my JSON response in Python. Any tips?

closed as off-topic by Vince, whyzar, BBG_GIS, Hornbydd, Jochen Schwarze Apr 15 at 8:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – Vince, whyzar, BBG_GIS, Hornbydd, Jochen Schwarze
If this question can be reworded to fit the rules in the help center, please edit the question.

  • While it's not particularly difficult to write a shapefile with pure Python, it's also unnecessary, since so many libraries support the format. Please choose a library and Edit the Question to include your coding attempt and a description of the problem you are encountering. – Vince Apr 12 at 12:26
  • @Vince Okey, do you have a suggestion on a library? – Felix Althén Bergman Apr 12 at 12:44
  • just read the json format in python > w3schools.com/python/python_json.asp – Mapperz Apr 12 at 13:47
  • 1
    I recommend pyshp to create a shapefile, github.com/GeospatialPython/pyshp – klewis Apr 12 at 15:29