Closed kinju4374 closed 2 years ago
Hi Kinju,
The text file you uploaded was just a fragment of a geojson file. When I surrounded it with the appropriate geojson attributes (see attached), I can load it into the map.
I hope this helps.
Hi Jeffrey,
Thanks but did you remove any extra arrays or just added the feature's value? As I mentioned it was developed by my other colleague and he has used the following logic, do you see any error here?
SELECT /* Element type dom - for jQuery selector e.g. body or #region-id, item - for item name e.g. P1_MY_ITEM */ 'item' as element_type, /* jQuery selector or item name */ 'P71_GEOJSON_BOUNDARY' as element_selector, CASE WHEN JSON_VALUE(SDO_UTIL.TO_GEOJSON(sdo_boundary),'$[*].type') ='Polygon' THEN REPLACE(REPLACE(REPLACE(SDO_UTIL.TO_GEOJSON(sdo_boundary),'] ] ]','],['||sdo_util.GetFirstVertex(T.sdo_boundary).X||','||sdo_util.GetFirstVertex(T.sdo_boundary).Y||']]]'),'[-.','[-0.'),'[.','[0.') ELSE SDO_UTIL.TO_GEOJSON(sdo_boundary) END as clob_value
I took the fragment and just surrounded it with the following to make it into a valid GeoJson feature:
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":
{
... (your original data) ...
}}]}
I don't know what data your query is getting so I don't know what might be going wrong in your case - generally I wouldn't prefer doing the sort of string manipulation that the query is doing, as it may or may not be reliable in all cases. I'd consider using the Oracle database's builtin JSON features to manipulate the JSON if needed to massage it into a form suitable for rendering.
Regardless of that, it looks like your colleague has added expressions to add the final vertex to the boundary of the polygon by searching for the final '] ] ]' in the string and replacing it with the description of an additional point based on the first vertex. If this is failing for some rows in your data, my suspicion would be that perhaps some of the rows don't have a literal '] ] ]' (including this exact arrangment of spaces between the closing brackets) and so maybe this replacement fails for some rows. That said, without an actual example of a failing row and seeing how it's being rendered (or not, as the case may be), I couldn't speculate further.
Hi @jeffreykemp
Further to this issue, I have this geojson which has an area with hole and it's causing the issue. As you view the file, you would able to see that there are 2 arrays in co-ordinates but when I remove the second array, it loads correctly. Could you please suggest if anything wrong with this area?
The additional point added to the end of the hole is causing the shape to be invalid:
, [ -4.10951131769857, 50.3671950381431 ]
Attached is a fixed version where I've added the surrounding geojs newAreawithHole.txt on document, and removed the extraneous point in the hole.
Thanks @jeffreykemp ,
You were correct it was due to replace and adding the first endpoints at the last, in this case it added the first endpoints of 1st array to 2nd array which is wrong and caused the issue.
Hi JeffreyKemp,
Thanks for creating this plugin, it's really useful to show boundaries. I was given this by my colleague who left the company and I am facing issues to understand a few things as I am not familiar with terminologies from the location.
I am getting the start and end positions are not the same for a geo json but I am not able to understand why? I can only seem to find out that it has 2 arrays and if I remove one of them then it works. Could you please check this file and let me know if any issues with json?
myArea.txt