I try to import a geojson to my Google map Android app. But I have the following error in code.
The Code for adding geojson:
GeoJsonLayer layer = new GeoJsonLayer(mMap, R.raw.nbg_bank ,
getApplicationContext());
layer.addLayerToMap();
and the error:unreported exception IOException; must be caught or declared to be thrown
Is the solution to do a try/catch?
When I do try/catch the code change to without any error but I can't see the pointss in the map's app:
GeoJsonLayer layer = null;
try {
layer = new GeoJsonLayer(mMap, R.raw.nbg_bank ,
getApplicationContext());
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
layer.addLayerToMap();
The answer is: the try/catch solution it is ok. The problem was the coordinate system. I use WGS84 but the EPSG:4326 is the correct not the epsg:3857 crs that I used.