Question

JSON to Shapefile Help

  • 18 February 2019
  • 1 reply
  • 3 views

Badge

Hi,

I'm wondering if you can help. I'm using FME to interact with the https://app.traveltimeplatform.com API using the HTTP Caller which returns a field with the below JSON:

[{"shell":[{"lat":51.5050330184,"lng":-0.145035260000001},{"lat":51.5054826584,"lng":-0.145484900000001},{"lat":51.5072812184,"lng":-0.145484900000001},{"lat":51.5077308584,"lng":-0.145035260000001},{"lat":51.5077308584,"lng":-0.143236700000001},{"lat":51.5081804984,"lng":-0.142787060000001},{"lat":51.5090797784,"lng":-0.142787060000001},{"lat":51.5099790584,"lng":-0.143686340000001},{"lat":51.5108783384,"lng":-0.143686340000001},{"lat":51.5117776184,"lng":-0.144585620000001},{"lat":51.5144754584,"lng":-0.144585620000001},{"lat":51.5153747384,"lng":-0.143686340000001},{"lat":51.5162740184,"lng":-0.143686340000001},{"lat":51.5167236584,"lng":-0.143236700000001},{"lat":51.5167236584,"lng":-0.142337420000001},{"lat":51.5158243784,"lng":-0.141438140000001},{"lat":51.5158243784,"lng":-0.139639580000001},{"lat":51.5149250984,"lng":-0.138740300000001},{"lat":51.5149250984,"lng":-0.136941740000002},{"lat":51.5167236584,"lng":-0.135143180000002},{"lat":51.5167236584,"lng":-0.133344620000002},{"lat":51.5158243784,"lng":-0.132445340000002},{"lat":51.5158243784,"lng":-0.130646780000002},{"lat":51.5149250984,"lng":-0.129747500000002},{"lat":51.5158243784,"lng":-0.128848220000002},{"lat":51.5158243784,"lng":-0.127049660000002},{"lat":51.5149250984,"lng":-0.126150380000002},{"lat":51.5149250984,"lng":-0.125251100000002},{"lat":51.5158243784,"lng":-0.124351820000002},{"lat":51.5158243784,"lng":-0.122553260000002},{"lat":51.5149250984,"lng":-0.121653980000002},{"lat":51.5149250984,"lng":-0.120754700000003},{"lat":51.5153747384,"lng":-0.120305060000003},{"lat":51.5162740184,"lng":-0.120305060000003},{"lat":51.5171732984,"lng":-0.121204340000003},{"lat":51.5176229384,"lng":-0.120754700000003},{"lat":51.5176229384,"lng":-0.118956140000003},{"lat":51.5158243784,"lng":-0.117157580000003},{"lat":51.5158243784,"lng":-0.113560460000003},{"lat":51.5149250984,"lng":-0.112661180000003},{"lat":51.5149250984,"lng":-0.109064060000003},{"lat":51.5135761784,"lng":-0.107715140000003},{"lat":51.5131265384,"lng":-0.108164780000003},{"lat":51.5131265384,"lng":-0.109963340000003},{"lat":51.5126768984,"lng":-0.110412980000003},{"lat":51.5108783384,"lng":-0.110412980000003},{"lat":51.5104286984,"lng":-0.110862620000003},{"lat":51.5104286984,"lng":-0.112661180000003},{"lat":51.5095294184,"lng":-0.113560460000003},{"lat":51.5095294184,"lng":-0.115359020000003},{"lat":51.5090797784,"lng":-0.115808660000003},{"lat":51.5081804984,"lng":-0.115808660000003},{"lat":51.5077308584,"lng":-0.115359020000003},{"lat":51.5077308584,"lng":-0.114459740000003},{"lat":51.5072812184,"lng":-0.114010100000003},{"lat":51.5063819384,"lng":-0.114909380000003},{"lat":51.5045833784,"lng":-0.114909380000003},{"lat":51.5041337384,"lng":-0.115359020000003},{"lat":51.5041337384,"lng":-0.118056860000003},{"lat":51.5036840984,"lng":-0.118506500000003},{"lat":51.5032344584,"lng":-0.118056860000003},{"lat":51.5032344584,"lng":-0.117157580000003},{"lat":51.5023351784,"lng":-0.116258300000003},{"lat":51.5023351784,"lng":-0.112661180000003},{"lat":51.5009862584,"lng":-0.111312260000003},{"lat":51.5005366184,"lng":-0.111761900000003},{"lat":51.5005366184,"lng":-0.112661180000003},{"lat":51.5000869784,"lng":-0.113110820000003},{"lat":51.4996373384,"lng":-0.112661180000003},{"lat":51.4996373384,"lng":-0.109963340000003},{"lat":51.4982884184,"lng":-0.108614420000003},{"lat":51.4978387784,"lng":-0.109064060000003},{"lat":51.4978387784,"lng":-0.110862620000003},{"lat":51.4969394984,"lng":-0.111761900000003},{"lat":51.4978387784,"lng":-0.112661180000003},{"lat":51.4978387784,"lng":-0.114459740000003},{"lat":51.4987380584,"lng":-0.115359020000003},{"lat":51.4987380584,"lng":-0.117157580000003},{"lat":51.4978387784,"lng":-0.118056860000003},{"lat":51.4987380584,"lng":-0.118956140000003},{"lat":51.4987380584,"lng":-0.120754700000003},{"lat":51.5005366184,"lng":-0.122553260000002},{"lat":51.5005366184,"lng":-0.125251100000002},{"lat":51.5000869784,"lng":-0.125700740000002},{"lat":51.4996373384,"lng":-0.125251100000002},{"lat":51.4996373384,"lng":-0.124351820000002},{"lat":51.4982884184,"lng":-0.123002900000002},{"lat":51.4964898584,"lng":-0.123002900000002},{"lat":51.4955905784,"lng":-0.123902180000002},{"lat":51.4937920184,"lng":-0.123902180000002},{"lat":51.4924430984,"lng":-0.125251100000002},{"lat":51.4928927384,"lng":-0.125700740000002},{"lat":51.4955905784,"lng":-0.125700740000002},{"lat":51.4960402184,"lng":-0.126150380000002},{"lat":51.4960402184,"lng":-0.127049660000002},{"lat":51.4969394984,"lng":-0.127948940000002},{"lat":51.4969394984,"lng":-0.130646780000002},{"lat":51.4978387784,"lng":-0.131546060000002},{"lat":51.4978387784,"lng":-0.133344620000002},{"lat":51.5005366184,"lng":-0.136042460000002},{"lat":51.5005366184,"lng":-0.137841020000002},{"lat":51.5014358984,"lng":-0.138740300000001},{"lat":51.5014358984,"lng":-0.139639580000001},{"lat":51.5045833784,"lng":-0.142787060000001},{"lat":51.5054826584,"lng":-0.142787060000001},{"lat":51.5059322984,"lng":-0.143236700000001},{"lat":51.5059322984,"lng":-0.144135980000001},{"lat":51.5050330184,"lng":-0.145035260000001}],"holes":[]}]

I'm looking to convert this to an ESRI Shapefile but i'm struggling to get this to convert. I've tried using the JSONFragmenter but i'm not sure if this is the correct approach.

 

Is this something you could advise on? Thanks for any help provided.

 

Thanks,

Charlie


1 reply

Userlevel 6
Badge +31

One possible solution, but as my Json-Fu is not astronomical it might not be the most best.

JSONFragmenter (json[*]) , JSONFlattener, AttributeExposer (shell{}), ListExploder, AttributeExposer (lng,lat) returned coordinates. You can build from there. I saw also Holes, but empty in your sample. I guess these are donutholes, please check the API documentation.

jsontopolygon.fmwt

Reply