"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spec/suites/layer/GeoJSONSpec.js" between
Leaflet-1.8.0.tar.gz and Leaflet-1.9.0.tar.gz

About: Leaflet is a JavaScript library for mobile-friendly interactive maps.

GeoJSONSpec.js  (Leaflet-1.8.0):GeoJSONSpec.js  (Leaflet-1.9.0)
skipping to change at line 574 skipping to change at line 574
}, },
{ {
type: "LineString", type: "LineString",
coordinates: [ coordinates: [
[10, 10], [20, 20] [10, 10], [20, 20]
] ]
} }
] ]
}; };
var featureCollection = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [0, 0]
}
},
]
};
function customPointToLayer(geojsonPoint, latLng) { function customPointToLayer(geojsonPoint, latLng) {
return L.circle(latLng, { return L.circle(latLng, {
radius: geojsonPoint.properties.radius radius: geojsonPoint.properties.radius
}); });
} }
function customCoordstoLatLng(coords) { function customCoordstoLatLng(coords) {
return L.latLng(coords[1] + 1, coords[0] + 1, coords[2] + 1); return L.latLng(coords[1] + 1, coords[0] + 1, coords[2] + 1);
} }
[ [
[point, L.Marker], [point, L.Marker],
[line, L.Polyline], [line, L.Polyline],
[polygon, L.Polygon], [polygon, L.Polygon],
[multiPoint, L.FeatureGroup], [multiPoint, L.FeatureGroup],
[multiLine, L.Polyline], [multiLine, L.Polyline],
[multiPolygon, L.Polygon], [multiPolygon, L.Polygon],
[geometryCollection, L.FeatureGroup] [geometryCollection, L.FeatureGroup],
[featureCollection, L.FeatureGroup]
].forEach(function (item) { ].forEach(function (item) {
var geometry = item[0], expectedType = item[1]; var geometry = item[0], expectedType = item[1];
it("creates a Layer from a GeoJSON feature (type='" + geo metry.type + "')", function () { it("creates a Layer from a GeoJSON feature (type='" + geo metry.type + "')", function () {
var layer = L.GeoJSON.geometryToLayer({ var layer = L.GeoJSON.geometryToLayer({
type: "Feature", type: "Feature",
geometry: geometry geometry: geometry
}); });
expect(layer).to.be.a(expectedType); expect(layer).to.be.a(expectedType);
}); });
skipping to change at line 827 skipping to change at line 841
[[1, 2], [3, 4], [5, 6], [1, 2]], [[1, 2], [3, 4], [5, 6], [1, 2]],
[[7, 8], [9, 10], [11, 12], [7, 8]] [[7, 8], [9, 10], [11, 12], [7, 8]]
]); ]);
}); });
it("returns a multidimensional array of coordinates with given pr ecision", function () { it("returns a multidimensional array of coordinates with given pr ecision", function () {
var latLngs = [L.latLng(2.123456, 1.123456), L.latLng(4.1 23456, 3.123456)]; var latLngs = [L.latLng(2.123456, 1.123456), L.latLng(4.1 23456, 3.123456)];
var coords = L.GeoJSON.latLngsToCoords(latLngs, 0, false, 3); var coords = L.GeoJSON.latLngsToCoords(latLngs, 0, false, 3);
expect(coords).to.eql([[1.123, 2.123], [3.123, 4.123]]); expect(coords).to.eql([[1.123, 2.123], [3.123, 4.123]]);
}); });
it('returns a valid geojson from an unbalanced multipolygon', fun
ction () {
var poly = L.polygon([
[
[
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.046]
],
[
[51.508, -0.06],
[51.504, -0.06],
[51.509, -0.05]
]
], [
[51.499, -0.08],
[51.493, -0.06],
[51.48, -0.046]
]
]);
expect(poly.toGeoJSON(3).geometry).to.eql({
type: 'MultiPolygon',
coordinates: [
[
[
[-0.08, 51.509],
[-0.06, 51.503],
[-0.046, 51.51],
[-0.08, 51.509]
],
[
[-0.06, 51.508],
[-0.06, 51.504],
[-0.05, 51.509],
[-0.06, 51.508]
]
], [
[-0.08, 51.499],
[-0.06, 51.493],
[-0.046, 51.48],
[-0.08, 51.499]
]
]
});
});
}); });
describe("#asFeature", function () { describe("#asFeature", function () {
var geometry1 = { var geometry1 = {
type: "Point", type: "Point",
coordinates: [0, 0] coordinates: [0, 0]
}; };
var geometry2 = { var geometry2 = {
type: "Point", type: "Point",
 End of changes. 3 change blocks. 
1 lines changed or deleted 62 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)