Skip to main content
Question

Hi all! I wish to produce a GeoJSON from an ESRI filegeodatabase featureclass with nested attributes. Searching the forums leads me to JSONTemplater, but I'm not sure how/what to fill in the JSONTemplater to proceed further.


Running the attached translator : Test_Pole_geodatabase_file2geojson.fmw, returns the attached Test_Pole.json, but I need the attributes: MEASURE, ACCURACY, VISIBILITY to be nested under a new "QUALITY" attribute. The translator returns this: 

{
	"type" : "FeatureCollection",
	"name" : "Test_Pole",
	"features" : [
		{
			"type" : "Feature",
			"geometry" : {
				"type" : "Point",
				"coordinates" : 5.073580993460.610033806436.882 ]
			},
			"properties" : {
				"OBJECTID" : 1,
				"HREF" : "foot",
				"STATE" : "existing",
				"MEASURE" : 99,
				"ACCURACY" : 500,
				"VISIBILITY" : 40,
				"MATERIAL" : "metall",
				"TYPE" : "high voltage",
				"INFORMATION" : "Example of high voltage"
			}

My goal is to achieve this:

{
	"type" : "FeatureCollection",
	"name" : "Test_Pole",
	"features" : [
		{
			"type" : "Feature",
			"geometry" : {
				"type" : "Point",
				"coordinates" : 5.073580993460.610033806436.882 ]
			},
			"properties" : {
				"OBJECTID" : 1,
				"HREF" : "foot",
				"STATE" : "existing",
				"QUALITY":{
				  "MEASURE" : 99,
				  "ACCURACY" : 500,
				  "VISIBILITY" : 40,
				},
				"MATERIAL" : "metall",
				"TYPE" : "high voltage",
				"INFORMATION" : "Example of high voltage"
			}

 Any suggestions (or maybe solutions :)  would be much appreciated.

3 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • February 17, 2023

Hi @tommb​,

You can use a JSONTemplater to create the QUALITY json structure from the MEASURE, ACCURACY and VISIBILITY attributes, then write it to the output GeoJSON as a json data type:

Screen Shot 2023-02-16 at 3.59.03 PMI am attaching the updated workspace for you.


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • February 17, 2023

@tommb​ 

I think your use case may be simple enough to not require using a JSONTemplater.

Use an AttributeCreator to create an attribute named QUALITY and set this attribute's value to:

{"MEASURE":@Value(MEASURE),"ACCURACY":@Value(ACCURACY),"VISIBILITY":@Value(VISIBILITY)}

In the GeoJSON writer's User Attributes tab, add the QUALITY attribute and set the type as JSON.


  • Author
  • February 17, 2023

Shout-out and many thanks to both @debbiatsafe​  and @daveatsafe​ for rapidly supplying solutions that worked liked a charm 😀


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings