Import JSON file into ArcMap

17775
10
Jump to solution
09-15-2015 11:39 AM
ChrisHolmes
Occasional Contributor III

Hello everyone,

I have a .json file which I would like to be able to import into ArcMap. The format of the json file when I receive it is like this:

[{"geometry":{"x":-5561.656,"y":5659411.683,"spatialReference":{"wkid":3776}},"attributes":{"EXTERNALNUM":"FILE1","STATUS":"OPEN","FILECLERK":"JANE DOE","RPID":1111111}},{"geometry":{"x":-4480.512000000001,"y":5671280.649,"spatialReference":{"wkid":3776}},"attributes":{"EXTERNALNUM":"FILE2","STATUS":"HOLD","FILECLERK":"BOB BROWN","RPID":2222222}}}]

Is this possible given the way the file is formatted? It doesn't seem to be formatted in a manner to work with the JSON toolset in ArcMap: ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Any suggestions appreciated,

Chris

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
ChrisSmith7
Frequent Contributor

Chris,

I had some time over lunch to look at this some more. I think I got it to work! Here's the updated app:

http://code.runnable.com/Vfig_eplbl55NWA1/terraformer-demo-for-node-js

Running this produces the following result from your demo JSON object:

{
  "features" : [{
  "type" : "Feature",
  "geometry" : {
  "type" : "Point",
  "coordinates" : [-0.04996120589815041, 45.24017485407551],
  "bbox" : [-0.04996120589815041, 45.24017485407551, -0.04996120589815041, 45.24017485407551]
  },
  "properties" : {
  "EXTERNALNUM" : "FILE1",
  "STATUS" : "OPEN",
  "FILECLERK" : "JANE DOE",
  "OBJECTID" : 1111111
  },
  "id" : 1111111,
  "bbox" : [-0.04996120589815041, 45.24017485407551, -0.04996120589815041, 45.24017485407551]
  }, {
  "type" : "Feature",
  "geometry" : {
  "type" : "Point",
  "coordinates" : [-0.04024912410280926, 45.31520080539314],
  "bbox" : [-0.04024912410280926, 45.31520080539314, -0.04024912410280926, 45.31520080539314]
  },
  "properties" : {
  "EXTERNALNUM" : "FILE2",
  "STATUS" : "HOLD",
  "FILECLERK" : "BOB BROWN",
  "OBJECTID" : 2222222
  },
  "id" : 2222222,
  "bbox" : [-0.04024912410280926, 45.31520080539314, -0.04024912410280926, 45.31520080539314]
  }
  ],
  "type" : "FeatureCollection",
  "bbox" : [-0.04996120589815041, 45.24017485407551, -0.04024912410280926, 45.31520080539314]
}

This works perfectly in Ogre:

Only thing to be aware of, the console log in the Runnable app puts in newlines. I copied the output into Notepad++, then use The JSTool >> JSFormater to pretty print and make it human readable. You can use any pretty print tool - I just needed to easily find where console.log was adding newlines. It probably wont matter if you write to file... I think it's something wonky with JSON stringify.

Also, Terraformer should allow you to adjust your PK, but I just changed it to OBJECTID as I had time getting it to work. Probably PEBKAC, but here's the documentation on it:

Terraformer

So, you could keep RPID instead of the default OBJECTID.

Hope this helped you!

View solution in original post

10 Replies
JuanLuera
Occasional Contributor III

Hola Chris,

I wanted to see if you had located a solution for your post, if not here is one of our Extension which may assist
you. it is a separate cost for this extension but you are able to download it and use it on a 60 day trial, and then determine if this would be a good investment for you, if you convert JSON’s that often. Thanks, Chris!

ArcGIS Data Interoperability

Work with industry standards such as CSV,
CAD, JSON, XML, and RSS

http://www.esri.com/software/arcgis/extensions/datainteroperability

Juan

0 Kudos
ChrisHolmes
Occasional Contributor III

Hi Juan,

I will take a look at this and check out the 60 day trial to see what I can do with it. Saying that, $2500/yr for a single license is pretty pricey. Maybe I should post this question over in the Python area and see if there are some ideas over there?

Thanks Juan. I didn't think it would be so tricky trying to find a way to get this data into ArcMap.

Chris

0 Kudos
ChrisSmith7
Frequent Contributor

Chris,

I haven't used this, but you might want to check-out this:

Terraformer

Sounds like it's a two-way conversion between GeoJSON and ArcGIS Geometry. Once you convert to GeoJSON, you should be able to use JSON toolset, or maybe something like Ogre - Ogre - ogr2ogr web client

0 Kudos
ChrisHolmes
Occasional Contributor III

Thanks Chris. I will check this out also.

Cheers

0 Kudos
ChrisSmith7
Frequent Contributor

I gotta head-out, but I started a runnable node.js app:

http://code.runnable.com/Vfig_eplbl55NWA1/terraformer-demo-for-node-js

I can get it to convert some test stuff from your example, but it's not recognized by Ogre... I'll have to look into it some more to see if Terraformer will work.

0 Kudos
ChrisHolmes
Occasional Contributor III

Hey Chris, thanks for taking the time. Much appreciated!

Chris

0 Kudos
ChrisSmith7
Frequent Contributor

Chris,

I had some time over lunch to look at this some more. I think I got it to work! Here's the updated app:

http://code.runnable.com/Vfig_eplbl55NWA1/terraformer-demo-for-node-js

Running this produces the following result from your demo JSON object:

{
  "features" : [{
  "type" : "Feature",
  "geometry" : {
  "type" : "Point",
  "coordinates" : [-0.04996120589815041, 45.24017485407551],
  "bbox" : [-0.04996120589815041, 45.24017485407551, -0.04996120589815041, 45.24017485407551]
  },
  "properties" : {
  "EXTERNALNUM" : "FILE1",
  "STATUS" : "OPEN",
  "FILECLERK" : "JANE DOE",
  "OBJECTID" : 1111111
  },
  "id" : 1111111,
  "bbox" : [-0.04996120589815041, 45.24017485407551, -0.04996120589815041, 45.24017485407551]
  }, {
  "type" : "Feature",
  "geometry" : {
  "type" : "Point",
  "coordinates" : [-0.04024912410280926, 45.31520080539314],
  "bbox" : [-0.04024912410280926, 45.31520080539314, -0.04024912410280926, 45.31520080539314]
  },
  "properties" : {
  "EXTERNALNUM" : "FILE2",
  "STATUS" : "HOLD",
  "FILECLERK" : "BOB BROWN",
  "OBJECTID" : 2222222
  },
  "id" : 2222222,
  "bbox" : [-0.04024912410280926, 45.31520080539314, -0.04024912410280926, 45.31520080539314]
  }
  ],
  "type" : "FeatureCollection",
  "bbox" : [-0.04996120589815041, 45.24017485407551, -0.04024912410280926, 45.31520080539314]
}

This works perfectly in Ogre:

Only thing to be aware of, the console log in the Runnable app puts in newlines. I copied the output into Notepad++, then use The JSTool >> JSFormater to pretty print and make it human readable. You can use any pretty print tool - I just needed to easily find where console.log was adding newlines. It probably wont matter if you write to file... I think it's something wonky with JSON stringify.

Also, Terraformer should allow you to adjust your PK, but I just changed it to OBJECTID as I had time getting it to work. Probably PEBKAC, but here's the documentation on it:

Terraformer

So, you could keep RPID instead of the default OBJECTID.

Hope this helped you!

ChrisHolmes
Occasional Contributor III

Chris,

Thanks very much for taking the time to do this. It's very nice of you!

Much appreciated,

Chris

0 Kudos
ChrisSmith7
Frequent Contributor

No problem - Chris, if it ends-up working out for you, would you mind marking an answer in case anyone else perusing the forums has the same question?

0 Kudos