Hot answers tagged

6

Leaflet author here. The vectors should redraw properly. The quote by @nathansnider is referring to the fact that vectors are not reprojected, but they animate with a CSS transform during animation. If they don't redraw, you should set up a JSFiddle test case and file an issue on GitHub. update: they currently redraw, but are not reprojected until the ...


6

The order is important. You can't add something to the map before it is defined. Try in this sequence. First define the termini, metroStops var termini = ... ; var metroStops = ...; Then define the basemap, but don't add it to the map yet var osmBase = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); var baseMaps = { "OSMBaseLayer": osmBase ...


6

There is a JavaScript from Convert between Latitude/Longitude & OS National Grid References which converts between easting/northings to lon/lat, which could be helpful. It is also available in GitHub


5

If I understand what you are asking, you have a basemap of the US, and geojson layers for zip codes and county shapes, and you want to toggle (turn on or off) the geojson layers? Leaflet layer control is designed for this Documentation http://leafletjs.com/reference.html#control-layers Example http://leafletjs.com/examples/layers-control.html Leaflet ...


5

There are two mode in MapServer in fact and it can be confusing for end users without knowledge about the project history. The first one, the now mostly outdated mode cgi (the url contains mode=browse) way where you don't rely on standards OGC webservices. It was supported in OpenLayers 2 by default because of history (more Mapserver instances not using ...


5

GeoTools is a Java library which can read and write GeoJSON and provides access to features like area via the JTS library. It will also help you to reproject the geometries from the lat/lon of GeoJSON to a suitable projection for calculating areas in m^2.


5

[Final Answer] I bet you can easily resolve this by setting the map's maxBounds equal to its initial bounds immediately upon loading. :) Just add this to your initializing code once your map variable is ready. map.setMaxBounds(map.getBounds()); [Original Response] When you instantiate your Leaflet map, you just need to pass in a maxBounds option ...


5

As already pointed out in the comments, the problem is that you are directly opening the HTML file in your browser. This will show up like file:///C:/map.html in your address bar. The OSMGeocoder plugin is calling the URL location.protocol+//nominatim.openstreetmap.org/search (see source code). This works on webservers because the location.protocol is ...


4

In ol3 version 3.10.0 things have changed. So is more clear than older versions but still more complicated than ol2. So for TILE (ol.layer.Tile) layers your code snip should look like: //declare the layer var osmLayer = new ol.layer.Tile({ source: new ol.source.OSM() }); //asign the listeners on the source of tile layer ...


4

If you need a modifyend event why dont you use it within the modify interaction.(I guess you use a modify interaction) check this modify.on('modifyend',function(e){ console.log("feature id is",e.features.getArray()[0].getId()); }); This event is available in the latest versions of ol3. In my code snip, I assume you only modify one fetaure at once ...


4

I think you need to use IdentityManager from the API that allows you to sign in with your arcgis.com account and then receive access to the data. Whatever users from your organization that have accounts can sign in as well. https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html And here is a sample that shows what I think you are trying to ...


4

I don't have Maptiler 1.0 Beta 2 to test with, so I'm making a couple of assumptions: You have tiles in the XYZ format and not the TMS format. I'm making this assumption because your screenshot shows "Google Maps Compatible" selected You are using Openlayer 2.x What I would do is to put the the two folders in one main folder such as: Map MAP_1A_1_1 ...


4

I think that graduated sizes are quite a recent QGIS feature (?2.10). I've therefore not implemented them yet in qgis2web. I can have a look at it, though. In answer to your other question, no, I'm not aware that you can directly use an SLD in OpenLayers3. Others might know better. UPDATE I've committed a change to the master branch at ...


4

map.flyTo() should be already available in Leaflet 1.0? However the parameters are different. See https://github.com/Leaflet/Leaflet/blob/master/src/map/anim/Map.FlyTo.js


4

You can do this several ways, I think that the easiest (if you only have a few GIS things to do) is to use Turf see here There are also a couple of GIS library whom are a bit heavier (size wise) leaflet: how to After you can also try openlayers3


4

Check the proj definition stored in the spatial_ref_sys, it should be different from the one used in the proj4js definition. For example, mine is the following: +proj=utm +zone=30 +ellps=intl +towgs84=-87,-98,-121,0,0,0,0 +units=m +no_defs Also epsg.io gives the one with the towgs84 parameters, so I'd change the Proj4js def.


4

No, this isn't possible. For one, if you were to load both API's, you would end up with a namespace collision with Dojo's Define and Require. For two, the API is obfuscated (not human readable) making it difficult to extract just the parts you need. Even if you could, there may be dependencies in that module preventing you from using it with an older API.


4

I'd recommend using something like the proj4 library, which has wrappers in several languages, including JavaScript - Proj4JS. For C#, there's proj4net It has the advantage you can translate between all sorts of projections, not just OSGB. I'm not a great JS developer, but something like this should do the trick to convert OSGB back to WGS84 EDIT oops.. ...


3

I am having the same issue in Google Chrome. Everything works correctly in Mozilla or IE. Here is my CSS definition of the div where the map is loading. .map { height: 35em; width: 100%; border-radius: 5px; border: 0.2em solid #209CA6; } When I go full screen this happens: I realized that reason why this is happening is the fixed setting of the height ...


3

You can by using ol.source getClosestFeatureToCoordindinate() and feature get(). Assuming your OpenStreetMap data is loaded into ol.source.Vector called osm. map.on('click', function(event) { var osm_id = osm.getClosestFeatureToCoordinate(event.coordinate).get('osm_id'); window.alert(osm_id); )}


3

It seems you re mixing some concepts features[i] = new ol.format.GeoJSON( url: './testData.geojson') }; The above code can't work because the ol.format.GeoJSON API does not accept url as a parameter eg the official doc. You also try to loop on a GeoJSON call (if I consider above sample was intented for this) The normal way (there are more than one) ...


3

You could – along the lines of map.on('zoomend' … insert a conditional statement into layer.on('click' … querying map.getZoom(): layer.on('click', function() { if(map.getZoom() < 10) { map.fitBounds(layer.getBounds()) } });


3

Outside of polling for size changes, there isn't a way to detect a resize of a <div>. I usually use absolute positioning on the map container and let Leaflet handle resize automatically. Like this: http://jsfiddle.net/asnyder14/0gsfdxeg/


3

The 4.0 beta 1 does not support KML. The KMLLayer will be supported in a future beta version. Beta 1 only supports the modules documented in the API Reference.


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

See code example Leaflet users map https://github.com/bmcbride/leaflet-users-map by Bryan McBride. There is used SQLite DB, but her easy replace on MySQL.


3

OpenLayers 3.9 introduced the z-index attribute to map layers, which lets you specify the drawing order of layers. Before 3.9, the layers are drawn in the order they are added to the map, as you have noticed. This kind of issue is however more properly solved by using the setVisibile method on the layer, since all you want to do is controlling it's ...


3

There is a setOpacity method for TileLayer. This should do what you want: $('#rangeSlider').slider().on('slide', function (ev) { sliderVal = ev.value; background.setOpacity(sliderVal/100); }); EDIT: Here is an example fiddle with sliders for controlling opacity of both the background (with .setOpacity) and a vector layer (with .setStyle): ...


3

When doing forEachFeatureAtPixel, you should do any filtrering inside the callback function. You have the feature and it's layer available as arguments. This would return the first clicked feature: var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) { return feature; } ); This would return the first clicked feature in ...


3

This is a very broad question, but the answer really comes down to what you would like to be doing with your career. There are a few areas you could 'specialize' in when it comes to GIS and programming, but it would be good to know a little of all if you want to be a developer rather than an analyst. .NET Programming Learning .NET (Visual Basic .NET ...



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