Added more robust method for only rendering GeoJSON geometry types that are supported

master
Robin Hawkes 2016-02-27 15:19:29 +00:00
rodzic a91ccae917
commit 0cc5d12459
4 zmienionych plików z 18 dodań i 22 usunięć

18
dist/vizicities.js vendored
Wyświetl plik

@ -11704,6 +11704,14 @@ return /******/ (function(modules) { // webpackBootstrap
features.forEach(function (feature) {
// feature.geometry, feature.properties
// Skip features that aren't polygons
//
// TODO: Add support for all GeoJSON geometry types, including Multi...
// geometry types
if (feature.geometry.type !== 'Polygon') {
return;
}
// Get style object, if provided
if (typeof _this4._options.style === 'function') {
style = _this4._options.style(feature);
@ -11711,16 +11719,6 @@ return /******/ (function(modules) { // webpackBootstrap
var coordinates = feature.geometry.coordinates;
// Skip if geometry is a point
//
// This should be a user-defined filter as it would be wrong to assume
// that people won't want to output points
//
// The default use-case should be to output points in a different way
if (!coordinates[0] || !coordinates[0][0] || !Array.isArray(coordinates[0][0])) {
return;
}
coordinates = coordinates.map(function (ring) {
return ring.map(function (coordinate) {
var latlon = (0, _geoLatLon2['default'])(coordinate[1], coordinate[0]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -267,6 +267,14 @@ class GeoJSONTile extends Tile {
features.forEach(feature => {
// feature.geometry, feature.properties
// Skip features that aren't polygons
//
// TODO: Add support for all GeoJSON geometry types, including Multi...
// geometry types
if (feature.geometry.type !== 'Polygon') {
return;
}
// Get style object, if provided
if (typeof this._options.style === 'function') {
style = this._options.style(feature);
@ -274,16 +282,6 @@ class GeoJSONTile extends Tile {
var coordinates = feature.geometry.coordinates;
// Skip if geometry is a point
//
// This should be a user-defined filter as it would be wrong to assume
// that people won't want to output points
//
// The default use-case should be to output points in a different way
if (!coordinates[0] || !coordinates[0][0] || !Array.isArray(coordinates[0][0])) {
return;
}
coordinates = coordinates.map(ring => {
return ring.map(coordinate => {
var latlon = LatLon(coordinate[1], coordinate[0]);