leaflet

Vue Leaflet map tiles in wrong order

自古美人都是妖i 提交于 2020-02-02 11:27:45
问题 I just trying Vue Leaflet and trying to use this example. But when I try it in my local server, the map has wrong order. Here's my code <template> <div class="home"> <l-map :zoom="zoom" :center="center"> <l-tile-layer :url="url" :attribution="attribution"></l-tile-layer> <l-polygon v-for="s in shapes" :key="s.id" :color="s.color" :lat-lngs="s.geometry.coordinates" @l-mouseover=change_color(s) > </l-polygon> </l-map> </div> </template> <script> import { LMap, LPolygon, LTileLayer } from 'vue2

Leaflet _ ReactJS - Where to find the invalidateSize property?

空扰寡人 提交于 2020-01-30 02:38:54
问题 I have tried to find it in: this.mapRef.current.leafletElement this.mapRef.current.getLeafletElement() invalidating this.mapRef.current.getLeafletElement().invalidateSize this.mapRef.current.leafletElement here my react snippet: import React, {Component, Fragment} from "react"; import L from "leaflet" import "~/lib/leaflet/leaflet.css" import "~/lib/leaflet/leaflet" import styled from "styled-components" import Head from 'next/head' constructor(props) { super(props); this.mapRef = React

Leaflet _ ReactJS - Where to find the invalidateSize property?

好久不见. 提交于 2020-01-30 02:38:26
问题 I have tried to find it in: this.mapRef.current.leafletElement this.mapRef.current.getLeafletElement() invalidating this.mapRef.current.getLeafletElement().invalidateSize this.mapRef.current.leafletElement here my react snippet: import React, {Component, Fragment} from "react"; import L from "leaflet" import "~/lib/leaflet/leaflet.css" import "~/lib/leaflet/leaflet" import styled from "styled-components" import Head from 'next/head' constructor(props) { super(props); this.mapRef = React

Adding geoJSON feature attribues to mapbox popup

谁说我不能喝 提交于 2020-01-25 11:03:46
问题 I am looking to add a popup with geoJSON attributes to each book store marker on my map. I have used "layer.feature.properties.name" within the marker.bindpopup method, but am getting a return of "undefined". L.mapbox.accessToken = 'jk.eyJ1IjsdkjfhskjdfhksdskdjflWNCJ9.Ov2O5PtskdljfsdR0lq3Q'; var map = L.mapbox.map('map', 'example.kks3kec4') .setView([38.633, -90.319],12); //add cafe, books store, and university geoJSON layers with styling var bookStore = L.mapbox.featureLayer() .loadURL('book

Setting zoom level for layers in leaflet

蓝咒 提交于 2020-01-25 06:13:14
问题 Continuing the query from here: https://gis.stackexchange.com/questions/340223/leaflet-making-features-gone-when-zoom-out I would like to have some layers completely gone when zooming out. I tried sth like this: map.on('zoomend', function (e) { zoom_based_layerchange(); }); function clean_map() { map.eachLayer(function (layer) { if (layer instanceof L.GeoJSON) { map.removeLayer(layer); } //console.log(layer); }); } function zoom_based_layerchange() { //console.log(map.getZoom()); var

How do switch Leaflet coordinates to where 0,0 is southwest?

只愿长相守 提交于 2020-01-25 05:50:05
问题 I am working on a leaflet project where I need the coordinates 0 to 4096 and which the leaflet coordinates that I need are the following: 0,0 bottom left (southWest) 0,4096' top left (northWest) 4096',4096' top right (northEast) 4096',0 bottom right (southEast) I have tried many things to get the coordinates to map as needed but no luck. Here is my jsfiddle with my example, which has a console.log when you click on the map which shows the coordinates. If you click in the top left you will see

Styling only one element in an array, in Leaflet's pointToLayer

二次信任 提交于 2020-01-25 05:10:10
问题 I'm trying to only style one element in an array and apply it to pointToLayer , while the other elements in the array stay at a default parameter. Specifically, I'm trying to have the most recent earthquake point to have a radius weight of 3 while leaving the remainder earthquake points with a radius weight of 1. Here is a picture of my legend/points on the map. As you can see Recent is identified with a larger radius weight. I thought the best way to do this was to create a function and call

Leaflet with D3 polylines

独自空忆成欢 提交于 2020-01-25 03:00:31
问题 Is it possible to use D3 for polylines in Leaflet? What I am trying to achieve is a less accurate, but more stylised, route display. I'd like to use d3's interpolation('monotone') on a line (or path) which runs through each marker point in Leaflet and creates a smooth, curved line. The only example I have found close to this is http://erasmus.ahoi.in which creates nice smooth arcs using d3 and canvas. Does anyone know of any examples of this? I have created a fiddle with some markers on a

How to combine key values from a json file to a geojson map file?

会有一股神秘感。 提交于 2020-01-24 19:45:24
问题 I'm trying to combine a GeoJSON map file with key values from a JSON file to use for a choropleth map. Here is what the files look like: data1.json { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "STATE": "06", "ZIPCODE": "94601" }, "geometry": { "type": "Polygon", "coordinates": [...] } }, { "type": "Feature", "properties": { "STATE": "06", "ZIPCODE": "94501" }, "geometry": { "type": "Polygon", "coordinates": [...] } } ] } data2.json { "94501": { "crime":

Large dataset not using JS/Leaflet functions correctly

≯℡__Kan透↙ 提交于 2020-01-24 14:21:30
问题 I've built an application wherein you can select a table in a database and then show the data on a Leaflet map. The data has a matching legend. I want my application to accept a variety of datasets and be able to display them on the map, with minimal programming alterations. This is a new demand and I've altered my previous code, but it's not optimal. One of my datasets is pretty large, 8000+ record with multipolygons and many column. When adding this dataset to the map, it takes some time to