Open RupertBarrow opened 3 months ago
Ok, i will work on that.
I'm actually using ngx-leaflet
, to be precise : https://github.com/bluehalo/ngx-leaflet
I've tried this which is a good start for me :
src/app/leaflet-better-filelayer
directoryleaflet-better-filelayer
source code into a src
directory under the one just created
// src/app/leaflet-better-filelayer/leaflet-better-filelayer.ts
import * as L from 'leaflet';
import './src/leaflet.betterfilelayer';
declare module 'leaflet' { namespace Control { interface BetterFileLoader { addTo(LMap: L.Map): BetterFileLoader; } interface BetterFileLayer { addTo(LMap: L.Map): BetterFileLoader; } function betterFileLayer(options?: BetterFileLayerOptions): BetterFileLoader; }
namespace Map { function mergeOptions(options?: BetterFileLayerMergeOptions): any; //function addInitHook(initHookFn: () => L.Control.BetterFileLayer): any; }
interface BetterFileLayerImportOptions { delimiter: string; latfield: string; lonfield: string; }
interface BetterFileLayerMergeOptions { betterFileLayerControl: boolean; }
interface BetterFileLayerOptions extends L.ControlOptions { fileSizeLimit?: number; importOptions?: BetterFileLayerImportOptions; text: { title: string; }; formats: string[];
initialize(options?: BetterFileLayerImportOptions): any;
onAdd(): HTMLElement;
onRemove(): HTMLElement;
onEachFeature(): void;
} }
- to import it into my component, I just add :
// src/app/tab1/tab1.page.ts
import './src/leaflet.betterfilelayer';
NB : I had to change the path to icons because Angular looks for them in `assets/`, and added this :
// src/app/leaflet-better-filelayer/src/leaflet.betterfilelayer.js
L.Icon.Default.mergeOptions({ iconUrl: "assets/marker-icon.png", shadowUrl: "assets/marker-shadow.png", iconSize: [30.8, 44.1], iconAnchor: [15.4, 44.1], popupAnchor: [0, -44], });
I have a Ionic + Angular + Leaflet application written in TypeScript and would like to use BetterFileLayer in it. I am missing a .d.ts file (and and other package.json details) to make it usable in TypeScript.
Could you please provide this ?