Page 1 of 1

Drawing a Geometry Polygon using a geojson file

Posted: February 7th, 2024, 5:42 am
by munirmdee1
Hello CSPro Users,

I have and application in which I need it to open a map and draw a polygon depending on the offline file saved in the device. I have an file named ea.geojson, after opening a satellite map, the application should be a able to draw that EA boundary according to the ea.geojson file.

I have tried it bu it does not work, maybe if I put logic here and tell me guys what went wrong

mymap.setBaseMap(Satellite);
geometry boundary;
boundary.load("./Maps/ea.geojson");
numeric geometryId = mymap.addGeometry(boundary);
mymap.show();

Staellite map opens successful but it does not show the EA boundary, loaded from thr geojson file.

Any help please, what is wrong is my syntax?

Thanks in advanced

Re: Drawing a Geometry Polygon using a geojson file

Posted: February 7th, 2024, 2:31 pm
by aaronw
I used your logic and it worked. I would verify the path to the geojson file and make sure the load succeeds. Then I would verify there isn't an issue with the geojson file. My suggestion would be to generate a new one using the Geometry example for your current location. Then display a map for your current location and load the geojson using your provided logic.

Re: Drawing a Geometry Polygon using a geojson file

Posted: February 9th, 2024, 9:24 am
by munirmdee1
Hi Aaron, maybe there is a problem with the geojson file, although I created it with QGIS, I there a sample geojson file that I can use to test?

Re: Drawing a Geometry Polygon using a geojson file

Posted: February 9th, 2024, 9:30 am
by Gregory Martin
Attached is a GeoJSON file showing the location of the Census Bureau.