diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 71c6ea4adf..310977d9f4 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -18,18 +18,15 @@ export class Class { export class Transformation { constructor(a: number, b: number, c: number, d: number); - transform(point: Point, scale?: number): Point; - untransform(point: Point, scale?: number): Point; } export namespace LineUtil { function simplify(points: Point[], tolerance: number): Point[]; - function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; + function isFlat(latlngs: LatLngExpression[]): boolean; } export namespace PolyUtil { diff --git a/types/proj4leaflet/index.d.ts b/types/proj4leaflet/index.d.ts index 81a16100e4..a33a3efb32 100644 --- a/types/proj4leaflet/index.d.ts +++ b/types/proj4leaflet/index.d.ts @@ -42,7 +42,7 @@ declare module 'leaflet' { class GeoJSON extends L.GeoJSON {} - const geoJson: (geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions) => GeoJSON; + const geoJson: (geojson?: Proj4GeoJSONFeature, options?: GeoJSONOptions) => GeoJSON; class ImageOverlay extends L.ImageOverlay {} @@ -57,3 +57,6 @@ declare module 'leaflet' { } } } +export type Proj4GeoJSONFeature = geojson.Feature & { + crs?: { type: string; properties: { name: string } } +}; diff --git a/types/proj4leaflet/proj4leaflet-tests.ts b/types/proj4leaflet/proj4leaflet-tests.ts index e061a4ca3a..930473d793 100644 --- a/types/proj4leaflet/proj4leaflet-tests.ts +++ b/types/proj4leaflet/proj4leaflet-tests.ts @@ -1,6 +1,5 @@ import * as L from 'leaflet'; -import 'proj4leaflet'; - +import * as proj4leaflet from "proj4leaflet"; import * as proj4 from 'proj4'; import LatLngBoundsExpression = L.LatLngBoundsExpression; @@ -43,12 +42,13 @@ const crs3 = new L.Proj.CRS('EPSG:3006', // geoJson proj4.defs("urn:ogc:def:crs:EPSG::26915", "+proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"); -const geojson = { +const geojson: proj4leaflet.Proj4GeoJSONFeature = { type: "Feature", geometry: { type: "Point", coordinates: [481650, 4980105] }, + properties: {}, crs: { type: "name", properties: {