Hi,
I am new to Neo4j , I want to import json file of particular cities into neo4j, but it has lots and lots of nested array , I dont know how to access the inner value of field, and searched many things, yet not get any answer,
neo4j version,: 3.5.17
desktop version: 1.3.10
browser version: 4.2.0
Sample json file:
**{"type":"FeatureCollection", **
"features": [
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-75.915125,38.720037999999995],[-75.915359,38.709506],[-75.909801,38.704992],[-75.909369,38.703889],[-75.907619,38.706168999999996],[-75.904116,38.704648],[-75.89867699999999,38.707256],[-75.912858,38.719997],[-75.915125,38.720037999999995]]]},"properties":{"STATEFP":"24","PLACEFP":"63825","PLACENS":"02391372","AFFGEOID":"1600000US2463825","GEOID":"2463825","NAME":"Preston","LSAD":"43","ALAND":1402223,"AWATER":9096}},
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-77.932906,39.657125],[-77.936332,39.653343],[-77.931286,39.653847999999996],[-77.925725,39.657014],[-77.926906,39.659485],[-77.932906,39.657125]]]},"properties":{"STATEFP":"24","PLACEFP":"17600","PLACENS":"02390800","AFFGEOID":"1600000US2417600","GEOID":"2417600","NAME":"Clear Spring","LSAD":"43","ALAND":297503,"AWATER":0}}
]}
I want to create nodes of city under city nodes, need information of geometry (type, coordinates), properties(stateFP,placeFP,Name)
I want this format(below attachment), can anyone help and tell the query for this?
I have tried below query, but its not give the expected output, could you anyone please correct the query
CALL apoc.load.jsonArray("file:///Maryland_Cities_cb_2019_24_place_500k.json")
yield value as file
WITH *
Unwind file.features as features
UNWIND features.geometry AS geometry
Unwind geometry.coordinates as geometryCoordinates
Unwind features.properties as properties
unwind properties.STATEFP as stateId
unwind properties.PLACEFP as placeId
unwind properties.NAME as cityName
MERGE (ct:city{coordinates:geometryCoordinates,stateId:stateId,place:placeId,cityName:cityName})
return *
Thanks lot for Advance