Tag Info

Hot answers tagged

3

POLYGON((-90.89 46.67,-90.89 46.67,-90.89 46.67,-90.89 46.67,-90.89 46.67)) Looks like WKT. If it is, you can convert features/layers/geojson to WKT using Wellknown or Wicket-Leaflet


3

You can almost certainly replace the mapbox.js library with leaflet.js. And I'd be surprised if the esri-leaflet library doesn't just work with the MapBox version of leaflet. I've got an old trivial example here (click on the map, or turn on the layer visibility): https://maps.gcc.tas.gov.au/propertyinformation#16/-41.4656/147.1808 Code here: ...


3

GeoJSON is a JSON format, and in that, the order of the attributes is not important. It does not matter if you have the "type": "FeatureCollection" first, or after the "features" array. Both will work with all software that read GeoJSON. However please note, that I think you have another problem in your data. I think your latitude & longitude values ...


3

You can try to use this tutorial from MapBox to get started. You will need to create your own GeoJSON data for the stores and fountains that you want to display, and you can use this website to generate the GeoJSON file.


3

You have to use the subset method (see ?subset.Spatial): subset(lines, X > 400 & Y=="YES") Alternatively you can use indexing operations via []: lines[lines$X > 400 & lines$Y=="YES", ] Your dplyr code filters just filters the data frame, but not the geometry.


2

With Leaflet.EasyButton, things get dirt simple; name your icon and function (hover text if you want): var home = { lat: 70.3, lng: 50.5, zoom: 8 }; L.easyButton('fa-home',function(btn,map){ map.setView([home.lat, home.lng], home.zoom); },'Zoom To Home').addTo(map); (aside) and the zoom example answer by toms with easyButton: // make a bar ...


2

This is the compromise between client-side and server-side data handling. You can try using TopoJSON to make your file smaller, but it's a little tricky to run, and works better on polygons, including simplification. I think you're best off using a server platform. CartoDB is free for small use like this, and it's got other advantages like fancy ...


2

Qgis2web can minify the GeoJSON. That will gain you a bit. It can also reduce the geometry precision - the number of decimal places (as qgis2leaf can). Edit: qgis2web also supports scale-dependent visibility. Could this help?


2

Building from the comment by @elrobis here is an example using jQuery for getting the georss and adding simple markers to a map: <html> <head> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> </head> <body> <div id="map" style="width: 700px; height: 500px"></div> ...


2

Both will appear to change size as you zoom, depending on your reference: L.circleMarker will change size relative to the map, but not relative to the screen (radius in screen pixels stays the same). L.circle will change size relative to your screen, but not the map, as you zoom (radius in map units stays the same). For me, it works as expected in your ...


2

The official definition for EPSG:3857 is +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs As you see, it is calculated on a sphere (a=b). Your formula is a bit contradictory: You define a lat-long coordinate system on the WGS84 ellispoid, then you add +init=epsg:3857 which should ...


1

Yes, you can! Actually I built something similar in this example some weeks ago (the basemap switcher doesn't look great, but the functionality is there): http://bl.ocks.org/iriberri/08abc420a376053c71d4 You can just save the basemap layer into a variable and change its _url parameter. Then, just redraw it: ...


1

Indirectly, using tokml, after first converting to geojson: <html> <head> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> </head> <body> <div id="map" style="width: 700px; height: 500px"></div> <script ...


1

Baed on the Openstreetmap database, there is a service https://osm.wno-edv-service.de/boundaries/ which lets you select and download boundary data in various formats. Just expand the nodes on the left panel of the countries you want. If this is too slow for you, take the data from http://www.gadm.org/country or http://www.naturalearthdata.com/downloads/.


1

You can export data for several boundaries from the main OSM database. Administrative boundaries are complete in OSM for admin_level=2 that are for whole countries, and they are very up-to-date. The deper you go in admin_level there are countries that have 100% coverage for each place region, other countries still have some gaps. When using data from OSM, ...


1

I'm not sure exactly how your geojson is formed, but the style argument in L.geoJson allows you to set styles for each feature. From this example: L.geoJson(states, { style: function(feature) { switch (feature.properties.party) { case 'Republican': return {color: "#ff0000"}; case 'Democrat': return {color: ...


1

I don't think you will need to call the highlightSelection function, try to update the onEachFeature function to something like the one below to append content to popup window for each layer: // Action for each feature of the choropleth function onEachFeature(feature, layer) { console.log("onEachFeature"); layer.bindPopup('hello, popup'); // ...


1

The issue is you are trying to call the createLabelIcon function before it is defined. I updated the code on the jsfiddle you provided by putting the createLabelIcon function on top and the code is working now.


1

I figured this out; the parameters are needed which reference the URL. var NASAGIBS_ViirsEarthAtNight2012 = L.tileLayer('http://map1.vis.earthdata.nasa.gov/wmts-webmerc/VIIRS_CityLights_2012/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}', { attribution: 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated ...


1

Yes, there are at least two ways. Leaflet's zoomend event. For example: map.on('zoomend', function() { var zoomLevel = map.getZoom(); if (zoomLevel > 10) map.removeLayer(highways); }); This is (very) incomplete. Most likely you will want to add and remove layers based on the current zoom level. Here is an example from MapBox for hiding ...


1

According to the Leaflet documentation, the layer config is an object literal with layer names as keys and layer objects as values. That means you can use [] to set the object key, here is the modified codes: var layerName = feature.properties.condition[0]; //layer control var baseMaps = { "OpenStreetMap": OSM, "Aerial Imagery": ...


1

The first question is what do you mean by interactive? Do you just mean basic pan and zoom, or do you need to let users click the map to get information on features? If you have an image of the mall layout, and want a simple interactive map image with pan and zoom, check out these two tutorials for using Leaflet as a kind of zoom image tool: ...


1

I think you will be best off using a tile server, and then your heat map on top. You don't want to be publishing your own OpenStreetMap. Follow this guide here: http://www.qgistutorials.com/en/docs/leaflet_maps_with_qgis2leaf.html Just replace the points dataset with your dataset.


1

Nowadays, you can use the getBounds method of a MultiPolygon object and than use that to set a map's bounds. var multipolygon = L.geoJson(foret); multipolygon.addTo(map); map.fitBounds(multipolygon.getBounds());



Only top voted, non community-wiki answers of a minimum length are eligible