public FeatureIterable decode(byte[] data) throws IOException { return decode(data, Filter.ALL); }
public FeatureIterable decode(byte[] data) throws IOException { return decode(data, Filter.ALL); }
public FeatureIterable decode(byte[] data, Set<String> layerNames) throws IOException { return decode(data, new Filter.Any(layerNames)); }
public FeatureIterable decode(byte[] data, String layerName) throws IOException { return decode(data, new Filter.Single(layerName)); }
public FeatureIterable decode(byte[] data, String layerName) throws IOException { return decode(data, new Filter.Single(layerName)); }
public FeatureIterable decode(byte[] data, Set<String> layerNames) throws IOException { return decode(data, new Filter.Any(layerNames)); }
private ListMultimap<String, Feature> decode(RawMap map) throws IOException { ArrayListMultimap<String, VectorTileDecoder.Feature> byLayer = ArrayListMultimap.create(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); VectorTileDecoder decoder = new VectorTileDecoder(); decoder.setAutoScale(false); for (Feature feat : decoder.decode(bos.toByteArray())) { // System.out.println(feat.getLayerName() + ": "); // System.out.print(feat.getAttributes()); // System.out.println(feat.getGeometry()); byLayer.put(feat.getLayerName(), feat); } return byLayer; }
private ListMultimap<String, Feature> decode(RawMap map) throws IOException { ArrayListMultimap<String, VectorTileDecoder.Feature> byLayer = ArrayListMultimap.create(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); VectorTileDecoder decoder = new VectorTileDecoder(); decoder.setAutoScale(false); for (Feature feat : decoder.decode(bos.toByteArray())) { // System.out.println(feat.getLayerName() + ": "); // System.out.print(feat.getAttributes()); // System.out.println(feat.getGeometry()); byLayer.put(feat.getLayerName(), feat); } return byLayer; }
public void checkSimpleMVT(String mimeType) throws Exception { String request = "wms?service=WMS&version=1.1.0&request=GetMap&layers=" + getLayerId(MockData.ROAD_SEGMENTS) + "&styles=&bbox=-1,-1,1,1&width=768&height=330&srs=EPSG:4326" + "&format=" + mimeType; MockHttpServletResponse response = getAsServletResponse(request); // the standard mime type is returned assertEquals(MapBoxTileBuilderFactory.MIME_TYPE, response.getContentType()); byte[] responseBytes = response.getContentAsByteArray(); VectorTileDecoder decoder = new VectorTileDecoder(); List<VectorTileDecoder.Feature> featuresList = decoder.decode(responseBytes).asList(); assertEquals(5, featuresList.size()); assertEquals( 3, featuresList .stream() .filter(f -> "Route 5".equals(f.getAttributes().get("NAME"))) .count()); assertEquals( 1, featuresList .stream() .filter(f -> "Main Street".equals(f.getAttributes().get("NAME"))) .count()); assertEquals("Extent should be 12288", 12288, featuresList.get(0).getExtent()); }