@Test public void testAddCRS() throws Exception { String orig = "{\"type\":\"Polygon\",\"coordinates\":[[[1.0, 1.0],[2.0, 2.0],[3.0, 1.0],[1.0, 1.0]]]}"; String expected = "{\"type\":\"Polygon\",\"coordinates\":[[[1.0,1.0],[2.0,2.0],[3.0,1.0],[1.0,1.0]]],\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}}}"; assertEquals(expected, Postgres.addCrsToGeoJSON(orig)); }
public static String addCrsToGeoJSON(String geoJson) throws BaleenException { if (Strings.isNullOrEmpty(geoJson)) { return geoJson; } try { Map<String, Object> geoJsonObj = MAPPER.readValue(geoJson, MAP_LIKE_TYPE); if (geoJsonObj == null) { throw new InvalidParameterException("Mapper returned null"); } if (geoJsonObj.get("crs") == null) { Map<String, Object> crs = new HashMap<>(); crs.put("type", "name"); Map<String, Object> srid = new HashMap<>(); srid.put("name", "EPSG:4326"); crs.put("properties", srid); geoJsonObj.put("crs", crs); return MAPPER.writeValueAsString(geoJsonObj); } else { return geoJson; } } catch (Exception e) { throw new BaleenException("Unable to parse GeoJSON", e); } }
Postgres extends BaleenConsumer { public static String addCrsToGeoJSON(String geoJson) throws BaleenException { if (Strings.isNullOrEmpty(geoJson)) { return geoJson; } try { Map<String, Object> geoJsonObj = MAPPER.readValue(geoJson, MAP_LIKE_TYPE); if (geoJsonObj == null) { throw new InvalidParameterException("Mapper returned null"); } if (geoJsonObj.get("crs") == null) { Map<String, Object> crs = new HashMap<>(); crs.put("type", "name"); Map<String, Object> srid = new HashMap<>(); srid.put("name", "EPSG:4326"); crs.put("properties", srid); geoJsonObj.put("crs", crs); return MAPPER.writeValueAsString(geoJsonObj); } else { return geoJson; } } catch (Exception e) { throw new BaleenException("Unable to parse GeoJSON", e); } } }
Postgres extends BaleenConsumer { public static String addCrsToGeoJSON(String geoJson) throws BaleenException { if (Strings.isNullOrEmpty(geoJson)) { return geoJson; } try { Map<String, Object> geoJsonObj = MAPPER.readValue(geoJson, MAP_LIKE_TYPE); if (geoJsonObj == null) { throw new InvalidParameterException("Mapper returned null"); } if (geoJsonObj.get("crs") == null) { Map<String, Object> crs = new HashMap<>(); crs.put("type", "name"); Map<String, Object> srid = new HashMap<>(); srid.put("name", "EPSG:4326"); crs.put("properties", srid); geoJsonObj.put("crs", crs); return MAPPER.writeValueAsString(geoJsonObj); } else { return geoJson; } } catch (Exception e) { throw new BaleenException("Unable to parse GeoJSON", e); } }  }
Postgres extends BaleenConsumer { public static String addCrsToGeoJSON(String geoJson) throws BaleenException { if (Strings.isNullOrEmpty(geoJson)) { return geoJson; } try { Map<String, Object> geoJsonObj = MAPPER.readValue(geoJson, MAP_LIKE_TYPE); if (geoJsonObj == null) { throw new InvalidParameterException("Mapper returned null"); } if (geoJsonObj.get("crs") == null) { Map<String, Object> crs = new HashMap<>(); crs.put("type", "name"); Map<String, Object> srid = new HashMap<>(); srid.put("name", "EPSG:4326"); crs.put("properties", srid); geoJsonObj.put("crs", crs); return MAPPER.writeValueAsString(geoJsonObj); } else { return geoJson; } } catch (Exception e) { throw new BaleenException("Unable to parse GeoJSON", e); } }  @Override void doInitialize(UimaContext aContext); static String addCrsToGeoJSON(String geoJson); static Class<? extends Entity> getSuperclass(
      Class<? extends Entity> c1, Class<? extends Entity> c2); String getTableName(String table); }
Postgres extends BaleenConsumer { public static String addCrsToGeoJSON(String geoJson) throws BaleenException { if (Strings.isNullOrEmpty(geoJson)) { return geoJson; } try { Map<String, Object> geoJsonObj = MAPPER.readValue(geoJson, MAP_LIKE_TYPE); if (geoJsonObj == null) { throw new InvalidParameterException("Mapper returned null"); } if (geoJsonObj.get("crs") == null) { Map<String, Object> crs = new HashMap<>(); crs.put("type", "name"); Map<String, Object> srid = new HashMap<>(); srid.put("name", "EPSG:4326"); crs.put("properties", srid); geoJsonObj.put("crs", crs); return MAPPER.writeValueAsString(geoJsonObj); } else { return geoJson; } } catch (Exception e) { throw new BaleenException("Unable to parse GeoJSON", e); } }  @Override void doInitialize(UimaContext aContext); static String addCrsToGeoJSON(String geoJson); static Class<? extends Entity> getSuperclass(
      Class<? extends Entity> c1, Class<? extends Entity> c2); String getTableName(String table); static final String KEY_POSTGRES; static final String PARAM_SCHEMA; static final String PARAM_PREFIX; static final String PARAM_CONTENT_HASH_AS_ID; }