use of com.revolsys.spring.resource.UrlResource in project com.revolsys.open by revolsys.
the class WmsClient method loadCapabilities.
public WmsCapabilities loadCapabilities() {
final Map<String, Object> parameters = new LinkedHashMap<>();
parameters.put(WmsParameters.SERVICE, WmsParameterValues.WMS);
parameters.put(WmsParameters.REQUEST, WmsParameterValues.GET_CAPABILITIES);
final UrlResource capabilitiesUrl = newServiceUrlResource(parameters);
try (InputStream in = capabilitiesUrl.getInputStream()) {
final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setValidating(false);
documentBuilderFactory.setNamespaceAware(true);
final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
final Document document = documentBuilder.parse(in);
this.capabilities = new WmsCapabilities(this, document.getDocumentElement());
return this.capabilities;
} catch (final Throwable e) {
throw Exceptions.wrap("Unable to read capabilities: " + capabilitiesUrl, e);
}
}
use of com.revolsys.spring.resource.UrlResource in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystemsLoader method validateEsri.
private void validateEsri() {
EsriCoordinateSystems.getCoordinateSystem(0);
for (final CoordinateSystem coordinateSytstem : EpsgCoordinateSystems.getCoordinateSystems()) {
if (coordinateSytstem instanceof GeographicCoordinateSystem) {
final GeographicCoordinateSystem geoCs = (GeographicCoordinateSystem) coordinateSytstem;
final int id = coordinateSytstem.getCoordinateSystemId();
final GeographicCoordinateSystem esri = EsriCoordinateSystems.getCoordinateSystem(id);
if (esri != null && !geoCs.equalsExact(esri)) {
// System.out.println(id + coordinateSytstem.getCoordinateSystemName());
}
} else if (coordinateSytstem instanceof ProjectedCoordinateSystem) {
final ProjectedCoordinateSystem projectedCs = (ProjectedCoordinateSystem) coordinateSytstem;
final int id = coordinateSytstem.getCoordinateSystemId();
final String wkt = new UrlResource("http://spatialreference.org/ref/epsg/" + id + "/esriwkt/").contentsAsString();
final ProjectedCoordinateSystem esri = GeometryFactory.floating2d(wkt).getCoordinateSystem();
final CoordinateOperationMethod coordinateOperationMethod = esri.getCoordinateOperationMethod();
if (esri != null && !projectedCs.equals(esri) && coordinateOperationMethod != null && Property.hasValue(coordinateOperationMethod.getName()) && !projectedCs.isDeprecated()) {
final Map<ParameterName, Object> p1 = projectedCs.getParameters();
final Map<ParameterName, Object> p2 = esri.getParameters();
final Set<ParameterName> n1 = p1.keySet();
final Set<ParameterName> n2 = p2.keySet();
if (!n1.equals(n2)) {
final TreeSet<ParameterName> nm1 = new TreeSet<>(n1);
nm1.removeAll(n2);
final TreeSet<ParameterName> nm2 = new TreeSet<>(n2);
nm2.removeAll(n1);
final String m = id + "\t" + coordinateSytstem.getCoordinateSystemName() + "\t" + nm1 + "\t" + nm2;
// System.out.println(m);
}
}
}
}
}
use of com.revolsys.spring.resource.UrlResource in project com.revolsys.open by revolsys.
the class ArcGisResponse method getResource.
public Resource getResource(final String child, final Map<String, ? extends Object> parameters) {
final UrlResource serviceUrl = getServiceUrl(child);
if (isUseProxy()) {
final StringBuilder queryUrl = new StringBuilder(serviceUrl.getUriString());
final String query = '?' + UrlUtil.getQueryString(parameters);
queryUrl.append(UrlUtil.percentEncode(query));
final String username = serviceUrl.getUsername();
final String password = serviceUrl.getPassword();
return new UrlResource(queryUrl, username, password);
} else {
return serviceUrl.newUrlResource(parameters);
}
}
Aggregations