Skip to main content
Question

Json to features


Forum|alt.badge.img
Dear All , 

 

 

I use geometry replace to convert json to feature , but it doesn't work it give an error , I tried geojson and esrijson both give an error , below is the json text which stored in a feature class . 

 

 

{

 

    "geometryType": "esriGeometryPolygon",

 

    "hasZ": false,

 

    "hasM": false,

 

    "features": [

 

        {

 

            "geometry": {

 

                "rings": [

 

                    [

 

                        [

 

                            6055422.478793681,

 

                            2809493.0711957584

 

                        ],

 

                        [

 

                            6055818.269231402,

 

                            2809235.807411239

 

                        ],

 

                        [

 

                            6055646.760041723,

 

                            2808978.5436267196

 

                        ],

 

                        [

 

                            6055293.8469014205,

 

                            2808998.333148606

 

                        ],

 

                        [

 

                            6055211.390560228,

 

                            2809206.12312841

 

                        ],

 

                        [

 

                            6055422.478793681,

 

                            2809493.0711957584

 

                        ]

 

                    ]

 

                ]

 

            },

 

            "attributes": {

 

                "GraphicType": "ProposedPlot",

 

                "IsSaved": "False"

 

            }

 

        }

 

    ]

 

}

7 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 17, 2014
Hi,

 

 

I copied your json adn paste it to a txt file. I read it with esrijson and get a 5 sided ploygon...no errors.

 

How have u stored this json object?

Forum|alt.badge.img
Thanks GIO , We are storing the features in to SQL server within ntext attribute 

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 17, 2014
I read that ntext is a single variable length string.

 

I made it one string and removed all spaces. It still works fine.

 

 

 

Maybe one or more json objects have a character count wich is too long for the field written too?

 

(i understand that the format definition is written ntext(n) where n is legth)

 

You could do a character count to see wath max. legth is of json objects.

 

 

You could go for nvarchar instead of ntext? Wich is what everyone advises.

 

ntext seems to be a depricated format btw.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 17, 2014
Hi,

 

 

you can use this to count characters

 

use a creator to make

 

char_count = @Evaluate([llength [split @Value(col0) {}]])

 


Forum|alt.badge.img
Hi , 

 

 

It is not a problem of charcter length , I tried it for the record I sent and still I am getting an error . Thanks , 

takashi
Evangelist
  • June 17, 2014
Hi,

 

 

I myself have no practical experience on JSON, but possibly the JSONFragmenter transformer with this query helps you to extract geometry objects from the full JSON document.

 

-----

 

JSON Query: json["features"][*]["geometry"]

 

-----

 

 

Takashi

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 17, 2014
Then maybe a faulty object (json incorrect) is in the dataset?

 

 

The only way i get it to yield an error is by remoinge somee brace, bracket or other punctuation mark so it can't parse it no more...

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