Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
position: 'absolute',
} as React.CSSProperties,
center: {
width: '50px',
height: '50px',
position: 'relative',
top: 'calc(50% - 80px)',
left: 'calc(50% - 25px)',
} as React.CSSProperties,
spinner: {
margin: 0,
padding: 0,
} as React.CSSProperties
};
const provider = new EsriProvider(); // does the search from address to lng and lat
interface IMapDataProps extends IGenericProps {
mapProps: any;
props: {
searchLocations: boolean;
};
}
interface IMapDataState extends IGenericState {
markers: Array<{ position: string[] }>;
locations: any[];
}
export default class MapData extends GenericComponent {
static defaultProps = {
position: 'absolute',
} as React.CSSProperties,
center: {
width: '50px',
height: '50px',
position: 'relative',
top: 'calc(50% - 80px)',
left: 'calc(50% - 25px)',
} as React.CSSProperties,
spinner: {
margin: 0,
padding: 0,
} as React.CSSProperties
};
const provider = new EsriProvider(); // does the search from address to lng and lat
interface IMapDataProps extends IGenericProps {
mapProps: any;
props: {
searchLocations: boolean;
};
};
interface IMapDataState extends IGenericState {
markers: Object[];
locations: any[];
}
export default class MapData extends GenericComponent {
static defaultProps = {
(async () => {
async function search(
provider: BaseProvider,
options = { query: 'Where is my home?' },
) {
return provider.search(options);
}
[
await search(new OpenStreetMapProvider()),
await search(new BingProvider({ key: 'BING_API_KEY' })),
await search(new EsriProvider()),
await search(new GoogleProvider({ key: 'GOOGLE_MAPS_API_KEY ' })),
].forEach(([{ x, y, bounds, label, raw }]) => ({ x, y, bounds, label, raw }));
})();
import L from 'leaflet';
import {
GeoSearchControl,
EsriProvider,
} from 'leaflet-geosearch';
const provider = new EsriProvider();
const searchControl = new GeoSearchControl({
provider: provider,
});
const map = new L.Map('map');
map.addControl(searchControl);