Question

Create Polygon with GeoJson and keep attributes

  • 25 March 2022
  • 9 replies
  • 44 views

Badge

Hello,

With an URL, I Can create polygon with a json Extractor and a geometryReplacer but it's impossible to keep the attributes. I can't expose any attributes. I don't know how to do.

imageimage The Json looks like this

image 

Any idea?

Thank you so muche


9 replies

Userlevel 5
Badge +25

You have to enter the names of the attributes you want to expose in that bottom box. For that, you either need to know what attributes can be there -or- check out one feature in the Feature Information Panel of Visual Preview (which shows more than the Table View)

Badge

Yes I know that but it doesn't work .It returns me nothing.

image

Userlevel 3
Badge +13

Yes I know that but it doesn't work .It returns me nothing.

image

Hello @kael112​ , would you be able to share a sample JSON file/URL with me? Going off of @Hans van der Maarel​ suggestion, the attributes should still around, just not exposed. You can check this by clicking on a feature in the Visual Preview Window, and then opening the 'Feature Information' window beside the table view (see image):

 

FeatInformationIf you can see your attributes in Feature Information window, all you have to do is expose them! You can do this in your JSONFragmenter_7 by using the 'Attributes to Expose' parameter or by adding an AttributeExposer after your Fragmenter - I would personally try to do this in the JSONFragmenter though.

 

Please let me know if you have anymore questions about this, or cannot see your attributes in the Feature Information! Best, Kailin.

Badge

Hello @kailinatsafe​ , unfortunetaly, I see nothing on the Visual Preview Window,only the coordinates.

imageThis is the Json.

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.4711899,44.8654793],[-0.4711999,44.8655797],[-0.4712177,44.8656794],[-0.4712354,44.8657600],[-0.4716340,44.8664852],[-0.4724261,44.8670228],[-0.4734634,44.8672721],[-0.4963334,44.8690323],[-0.4964455,44.8690391],[-0.4965580,44.8690424],[-0.4979659,44.8690611],[-0.4992957,44.8688132],[-0.5002471,44.8681076],[-0.5007033,44.8674984],[-0.5010003,44.8666632],[-0.5011139,44.8532494],[-0.5011059,44.8530948],[-0.5010792,44.8529412],[-0.4993389,44.8455520],[-0.4989132,44.8448141],[-0.4980810,44.8442794],[-0.4970058,44.8440532],[-0.4926865,44.8438559],[-0.4916598,44.8439605],[-0.4907784,44.8443494],[-0.4808709,44.8510683],[-0.4803406,44.8515849],[-0.4714419,44.8646158],[-0.4711899,44.8654793]]]},"properties":{"gid":7,"geom_err":null,"ident":"FLEX51","libelle":"Flexo 51","type":"ARRIVEE","rs_sv_arret_p_ent_a":4099,"rs_sv_arret_p_ent_r":null,"rs_sv_arret_p_sor_a":null,"rs_sv_arret_p_sor_r":null,"rs_sv_ligne_a":84,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.6762588,44.8860847],[-0.6766029,44.8869121],[-0.6785315,44.8892548],[-0.6796731,44.8899855],[-0.6811988,44.8901125],[-0.6825470,44.8895892],[-0.6832214,44.8886081],[-0.6835488,44.8870289],[-0.6834203,44.8861452],[-0.6827129,44.8854129],[-0.6805979,44.8840950],[-0.6794117,44.8836817],[-0.6780943,44.8837493],[-0.6770040,44.8842796],[-0.6764378,44.8851280],[-0.6762967,44.8856825],[-0.6762618,44.8858828],[-0.6762588,44.8860847]]]},"properties":{"gid":23,"geom_err":null,"ident":"FLEX84","libelle":"Ligne 84","type":"INTERMEDIAIRE","rs_sv_arret_p_ent_a":4686,"rs_sv_arret_p_ent_r":4832,"rs_sv_arret_p_sor_a":4829,"rs_sv_arret_p_sor_r":3602,"rs_sv_ligne_a":110,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.5005939,44.9323824],[-0.5009229,44.9331945],[-0.5017375,44.9338104],[-0.5020642,44.9339623],[-0.5021528,44.9340017],[-0.5022436,44.9340385],[-0.5109548,44.9373955],[-0.5123845,44.9376064],[-0.5137407,44.9372220],[-0.5145730,44.9363699],[-0.5146399,44.9362235],[-0.5147639,44.9356464],[-0.5146212,44.9350715],[-0.5116421,44.9290372],[-0.5108458,44.9282342],[-0.5102667,44.9279010],[-0.5096780,44.9276477],[-0.5039607,44.9258906],[-0.5027199,44.9257503],[-0.5015368,44.9260508],[-0.5007024,44.9267181],[-0.5004219,44.9275882],[-0.5005924,44.9323504],[-0.5005939,44.9323824]]]},"properties":{"gid":16,"geom_err":null,"ident":"FLEX49_1","libelle":"Flexo 49","type":"INTERMEDIAIRE","rs_sv_arret_p_ent_a":2040,"rs_sv_arret_p_ent_r":1926,"rs_sv_arret_p_sor_a":1924,"rs_sv_arret_p_sor_r":2041,"rs_sv_ligne_a":82,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.4933012,44.9419938],[-0.4938381,44.9430261],[-0.4939054,44.9430871],[-0.4946573,44.9435456],[-0.4955993,44.9437643],[-0.5070560,44.9447371],[-0.5085960,44.9445199],[-0.5096603,44.9437002],[-0.5098405,44.9425925],[-0.5090673,44.9416221],[-0.5089879,44.9415705],[-0.5076922,44.9411229],[-0.5025659,44.9405185],[-0.5024649,44.9405081],[-0.5023634,44.9405006],[-0.4960459,44.9401227],[-0.4946585,44.9403214],[-0.4936375,44.9410175],[-0.4933012,44.9419938]]]},"properties":{"gid":17,"geom_err":null,"ident":"FLEX49_2","libelle":"Flexo 49","type":"INTERMEDIAIRE","rs_sv_arret_p_ent_a":3078,"rs_sv_arret_p_ent_r":188,"rs_sv_arret_p_sor_a":187,"rs_sv_arret_p_sor_r":3079,"rs_sv_ligne_a":82,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}}

 

Thank you

Userlevel 2
Badge +10

Hello @kailinatsafe​ , unfortunetaly, I see nothing on the Visual Preview Window,only the coordinates.

imageThis is the Json.

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.4711899,44.8654793],[-0.4711999,44.8655797],[-0.4712177,44.8656794],[-0.4712354,44.8657600],[-0.4716340,44.8664852],[-0.4724261,44.8670228],[-0.4734634,44.8672721],[-0.4963334,44.8690323],[-0.4964455,44.8690391],[-0.4965580,44.8690424],[-0.4979659,44.8690611],[-0.4992957,44.8688132],[-0.5002471,44.8681076],[-0.5007033,44.8674984],[-0.5010003,44.8666632],[-0.5011139,44.8532494],[-0.5011059,44.8530948],[-0.5010792,44.8529412],[-0.4993389,44.8455520],[-0.4989132,44.8448141],[-0.4980810,44.8442794],[-0.4970058,44.8440532],[-0.4926865,44.8438559],[-0.4916598,44.8439605],[-0.4907784,44.8443494],[-0.4808709,44.8510683],[-0.4803406,44.8515849],[-0.4714419,44.8646158],[-0.4711899,44.8654793]]]},"properties":{"gid":7,"geom_err":null,"ident":"FLEX51","libelle":"Flexo 51","type":"ARRIVEE","rs_sv_arret_p_ent_a":4099,"rs_sv_arret_p_ent_r":null,"rs_sv_arret_p_sor_a":null,"rs_sv_arret_p_sor_r":null,"rs_sv_ligne_a":84,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.6762588,44.8860847],[-0.6766029,44.8869121],[-0.6785315,44.8892548],[-0.6796731,44.8899855],[-0.6811988,44.8901125],[-0.6825470,44.8895892],[-0.6832214,44.8886081],[-0.6835488,44.8870289],[-0.6834203,44.8861452],[-0.6827129,44.8854129],[-0.6805979,44.8840950],[-0.6794117,44.8836817],[-0.6780943,44.8837493],[-0.6770040,44.8842796],[-0.6764378,44.8851280],[-0.6762967,44.8856825],[-0.6762618,44.8858828],[-0.6762588,44.8860847]]]},"properties":{"gid":23,"geom_err":null,"ident":"FLEX84","libelle":"Ligne 84","type":"INTERMEDIAIRE","rs_sv_arret_p_ent_a":4686,"rs_sv_arret_p_ent_r":4832,"rs_sv_arret_p_sor_a":4829,"rs_sv_arret_p_sor_r":3602,"rs_sv_ligne_a":110,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.5005939,44.9323824],[-0.5009229,44.9331945],[-0.5017375,44.9338104],[-0.5020642,44.9339623],[-0.5021528,44.9340017],[-0.5022436,44.9340385],[-0.5109548,44.9373955],[-0.5123845,44.9376064],[-0.5137407,44.9372220],[-0.5145730,44.9363699],[-0.5146399,44.9362235],[-0.5147639,44.9356464],[-0.5146212,44.9350715],[-0.5116421,44.9290372],[-0.5108458,44.9282342],[-0.5102667,44.9279010],[-0.5096780,44.9276477],[-0.5039607,44.9258906],[-0.5027199,44.9257503],[-0.5015368,44.9260508],[-0.5007024,44.9267181],[-0.5004219,44.9275882],[-0.5005924,44.9323504],[-0.5005939,44.9323824]]]},"properties":{"gid":16,"geom_err":null,"ident":"FLEX49_1","libelle":"Flexo 49","type":"INTERMEDIAIRE","rs_sv_arret_p_ent_a":2040,"rs_sv_arret_p_ent_r":1926,"rs_sv_arret_p_sor_a":1924,"rs_sv_arret_p_sor_r":2041,"rs_sv_ligne_a":82,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-0.4933012,44.9419938],[-0.4938381,44.9430261],[-0.4939054,44.9430871],[-0.4946573,44.9435456],[-0.4955993,44.9437643],[-0.5070560,44.9447371],[-0.5085960,44.9445199],[-0.5096603,44.9437002],[-0.5098405,44.9425925],[-0.5090673,44.9416221],[-0.5089879,44.9415705],[-0.5076922,44.9411229],[-0.5025659,44.9405185],[-0.5024649,44.9405081],[-0.5023634,44.9405006],[-0.4960459,44.9401227],[-0.4946585,44.9403214],[-0.4936375,44.9410175],[-0.4933012,44.9419938]]]},"properties":{"gid":17,"geom_err":null,"ident":"FLEX49_2","libelle":"Flexo 49","type":"INTERMEDIAIRE","rs_sv_arret_p_ent_a":3078,"rs_sv_arret_p_ent_r":188,"rs_sv_arret_p_sor_a":187,"rs_sv_arret_p_sor_r":3079,"rs_sv_ligne_a":82,"cdate":"2022-03-28T00:00:00+02:00","mdate":"2022-03-28T03:53:22+02:00"}}

 

Thank you

Hi @kael112​ thank you for sending the sample JSON. I have attached a sample workspace that extracts the geometry without removing the attributes. 

A JSONExtractor uses a query to extract the geometry string into a new attribute called 'geometry' and then a JSONfFlattener extracts the attributes that we need. Next, a GeometryReplacer creates the geometry features without removing the attributes. 

 

Hope this helps!

Badge

Hi @danminneyatsaf​ , it doesn't work with the HttpCaller.Can you try with an URL? I Can't give you mine because there is a authentification key but if you need it, i can give you by personal message.

image

Userlevel 2
Badge +10

Hi @danminneyatsaf​ , it doesn't work with the HttpCaller.Can you try with an URL? I Can't give you mine because there is a authentification key but if you need it, i can give you by personal message.

image

@kael112​ I found that the JSON you posted above was missing some closing brackets at the end of the JSON structure, so I manually added the missing brackets. Perhaps this is having an effect on the way the JSONFragmenter is handling the response_body from the HTTPCaller.

 

Either way I'd still be interested in taking a look at your workspace and HTTPCaller setup. You can upload it to our Safe Support FTP or if that's not possible, submit a Support Case and we will follow up with you there.

Badge

Ok @danminneyatsaf​  ,I sent you the Json with the workspace. I hope it works. I sent you an other one (new 13.json), you can delete it!

image

Userlevel 2
Badge +10

Ok @danminneyatsaf​  ,I sent you the Json with the workspace. I hope it works. I sent you an other one (new 13.json), you can delete it!

image

@kael112​ Thank you for sending the workspace and JSON. I removed the JSONExtractor from your workspace and attached the transformers from the workspace I sent above (json_to_polygons.fmw) and was able to successfully parse the JSON response from the HTTPCaller and extract the polygons.

image 

I attached the workspace for your use (httpcaller_json_support.fmw). Note: I removed any sensitive information from your workspace so you will need to re-configure the HTTPCaller.

 

Hope this helps!

Reply