public DomainType getSrsParameter(WFSInfo wfs) { List<String> extraSRS = wfs.getSRS(); Set<String> srsParameterValues; GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_20); String prefix = gml.getSrsNameStyle().getPrefix(); Function<String, String> epsgMapper = srs -> qualifySRS(prefix, srs); if (extraSRS != null && !extraSRS.isEmpty()) { srsParameterValues = extraSRS.stream() .map(epsgMapper) .collect(Collectors.toCollection(LinkedHashSet::new)); } else { srsParameterValues = new LinkedHashSet<>(); } // add values from feature types gs.getCatalog() .getFeatureTypes() .forEach( ft -> { String srs = epsgMapper.apply(ft.getSRS()); srsParameterValues.add(srs); }); // build the parameter DomainType srsParameter = new DomainType("srsName", new ArrayList<>(srsParameterValues)); return srsParameter; }
wfs.getGML().get(WFSInfo.Version.V_11).getSrsNameStyle().toSrsSyntax());
transformer.setSrsName(gml.getSrsNameStyle().getPrefix() + srs);
@Override protected Configuration customizeConfiguration( Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) { FeatureTypeSchemaBuilder schemaBuilder = new FeatureTypeSchemaBuilder.GML32(geoServer); ApplicationSchemaXSD2 xsd = new ApplicationSchemaXSD2(schemaBuilder); xsd.setBaseURL(GetFeatureRequest.adapt(request).getBaseURL()); xsd.setResources(resources); org.geotools.wfs.v2_0.WFSConfiguration wfs = new org.geotools.wfs.v2_0.WFSConfiguration(); wfs.getDependency(GMLConfiguration.class) .setSrsSyntax( getInfo() .getGML() .get(WFSInfo.Version.V_20) .getSrsNameStyle() .toSrsSyntax()); ApplicationSchemaConfiguration2 config = new ApplicationSchemaConfiguration2(xsd, wfs); // adding properties from original configuration to allow // hints handling config.getProperties().addAll(configuration.getProperties()); return config; }
void doTestSrsNameSyntax(SrsNameStyle srsNameStyle, boolean doSave) throws Exception { if (doSave) { WFSInfo wfs = getWFS(); GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_20); gml.setSrsNameStyle(srsNameStyle); getGeoServer().save(wfs); } String q = "wfs?request=getfeature&service=wfs&version=2.0.0&typenames=cgf:Points"; Document d = getAsDOM(q); assertEquals("wfs:FeatureCollection", d.getDocumentElement().getNodeName()); XMLAssert.assertXpathExists( "//gml:Envelope[@srsName = '" + srsNameStyle.getPrefix() + "32615']", d); XMLAssert.assertXpathExists( "//gml:Point[@srsName = '" + srsNameStyle.getPrefix() + "32615']", d); } }
public String getPrefix() { return toSrsSyntax().getPrefix(); }
void doTestSrsNameSyntax11(SrsNameStyle srsNameStyle, boolean doSave) throws Exception { if (doSave) { WFSInfo wfs = getWFS(); GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_11); gml.setSrsNameStyle(srsNameStyle); getGeoServer().save(wfs); } String q = "wfs?request=getfeature&service=wfs&version=1.1.0&typename=cgf:Points"; Document d = getAsDOM(q); assertEquals("wfs:FeatureCollection", d.getDocumentElement().getNodeName()); XMLAssert.assertXpathExists( "//gml:Envelope[@srsName = '" + srsNameStyle.getPrefix() + "32615']", d); XMLAssert.assertXpathExists( "//gml:Point[@srsName = '" + srsNameStyle.getPrefix() + "32615']", d); } }
private String applySRSNameStyle(GMLInfo gml, String srs) { if (srs != null) { String prefix = gml.getSrsNameStyle().getPrefix(); if (srs.matches("(?ui)EPSG:[0-9]+")) { srs = prefix + srs.substring(5); } else { srs = prefix + srs; } } return srs; }
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((srsNameStyle == null) ? 0 : srsNameStyle.hashCode()); return result; }
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof GMLInfo)) return false; final GMLInfo other = (GMLInfo) obj; if (srsNameStyle == null) { if (other.getSrsNameStyle() != null) return false; } else if (!srsNameStyle.equals(other.getSrsNameStyle())) return false; return true; }
public SrsNameStyle fromSrsSyntax(SrsSyntax srsSyntax) { for (SrsNameStyle s : values()) { if (s.toSrsSyntax() == srsSyntax) { return s; } } return null; } }