Tag Info

Hot answers tagged

8

They are functionally equivalent. The difference is that require() loads modules using AMD while your second example uses a class from a global variable populated by Dojo's module loader in legacy mode. Technically, you should have to use dojo.require("esri.geomtry.Point") for your second example to work but because the module that defines that class is ...


8

There's a lot of subjectivity still in play, but I think a broad answer to your question is that it's getting easier every day to use GeoJSON directly in a leaflet map without tiling, and this is ultimately a good direction for interactive maps to be going. As such I tend to build maps using your third option above. That comes with a few caveats. You ...


5

You can use jquery Ajax to load data and then add it. var district_boundary = new L.geoJson(); district_boundary.addTo(map); $.ajax({ dataType: "json", url: "data/district.geojson", success: function(data) { $(data.features).each(function(key, data) { district_boundary.addData(data); }); } }).error(function() {}); or You can use ...


5

The BasemapToggle can only use basemaps from arcgis.com. I'll get the text on the page you referenced updated, it shouldn't say you can use your own custom basemaps. I apologize for the mistake. Edit: it is possible to use custom maps with the basemap toggle, but it takes a little work. First, load the default API config object and put info for your ...


5

You can do it now, as of version 0.7 there is an additional option called 'maxNativeZoom' after which it will interpolate tiles. Here's a link to the documentation: http://leafletjs.com/reference.html#tilelayer Here's the info: minZoom Number 0 Minimum zoom number. maxZoom Number 18 Maximum zoom number. maxNativeZoom Number null Maximum zoom ...


5

I am not sure if I completely understand what your application is doing. Are you sending a query to postGIS every time the bbox changes and then render the response as a vector layer? If that's the case, in my experience, there are no obvious solutions to the problem. No magic bullets yet, but still solutions can be found, here some ideas: Maybe not what ...


5

I think that your are thinking it is more complex than you think! Try this: var popLocation= new L.LatLng(-42.8585,147.2468); var popup = L.popup() .setLatLng(popLocation) .setContent('<p>Hello world!<br />This is a nice popup.</p>') .openOn(map); Sourced from the excellent documentation. I know what you want to do now. ...


5

You can get it with JSTS. Check DistanceOp.js.


5

Your units are in decimal degrees and they should be in a projected coordinate system. If you still have the gps unit, you can change it to something like an appropriate UTM projection then download the coordinates and use those in your calculation.


5

It's simple: create L.Map with scrollWheelZoom: false option, then add a listener: map.once('focus', function() { map.scrollWheelZoom.enable(); });


4

If you want to ZoomTo a specific ZoomLevel , you can use Map.zoomTo like this: map.zoomTo(level); \\where level is an integer, indicating the zoom level If you just want to Zoom out one level, you can use Map.zoomOut like this: map.zoomOut()


4

Change the order of your js-files. Load OpenLayers before the files within js-folder. <script src="ol-211/OpenLayers.js"></script> <script src="ol-211/firebug.js"></script> <script type="text/javascript" src="js/geocoding.js"></script> <script type="text/javascript" src="js/map1.js"></script> <script ...


4

I have written down a small piece of code might be helpful for you. You can try working example on jsFiddle <!DOCTYPE html> <html> <head> <title>Leaflet - Marker Click Event</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" ...


4

This is a pure Javascript api that performs Dissolve, also commonly called Union, and other spatial operations. It is based on Java Topology Suite. jsts


4

Since your search region is circular, it is perhaps best not to consider it to be a polygon, but as a point with a radius and to use the ST_DWithin() function: ST_DWithin — Returns true if the geometries are within the specified distance of one another. It should save you and the processor a lot of effort.


4

I think there is no better way than to handle zoomend event. To group markers by zoom levels, use L.LayerGroup: turning them on and off will be easier. Calling map.removeLayer() or map.addLayer() twice won't produce any errors or add a layer twice: there is an internal hash that prevents such things. So you can just have a bunch of if (zoom > 6 ...


4

Echoing Bill: it depends. I would say never/rarely do the second option. Keep your data and styling separate. The first and third options might be rephrased as "when should I use a service to render map features?" and "when should I use Leaflet to render map features in-browser?" For me, I try to do the third option whenever I can. Rendering features in ...


4

The OpenLayers.Control documentation says: Controls by default are added to the map they are contained within however it is possible to add a control to an external div by passing the div in the options parameter. So you just need to pass the div to the control while initialising it, somewhat like this: var mp=new ...


3

Your module IDs in your require dependency list do not match the aliases in the callback provided to require(). Things get out of whack after dojo/parser... Here's a working example with a corrected require: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta ...


3

A proxy page can also be used to bypass an authenticated service with 10.x versions of the APIs. A few things to note: Bypassing the Windows authentication with a proxy page will cause all of your connections to be made by the identity of the application pool that runs the proxy page, or by the identity of the connection you make within the proxy page. ...


3

Just to add for future reference, I got JSTS to work with Leaflet.js by exporting / importing GeoJSON between the two libraries. It's obviously not very efficient if you're doing a lot of processing but for simple one off conversions it's a pretty straightforward solution. function buffer(leafletGeometry, distance){ var reader = new ...


3

You can use this for creating dynamic colors var color; var r = Math.floor(Math.random() * 255); var g = Math.floor(Math.random() * 255); var b = Math.floor(Math.random() * 255); color= "rgb("+r+" ,"+g+","+ b+")"; then use this var firstpolyline = new L.Polyline(pointsSelection, { color: color, weight: 5, smoothFactor: 1 }); I think this ...


3

I don't know what happened anyone with greater knowledge can explain but for anyone with similar problem I solved it by adding controls: // Panel (toolbar) var oDragPanCtrl = new OpenLayers.Control.DragPan({ isDefault: true, title: 'Pan map: keep the left mouse button pressed to drag the map' }); var oZoomBoxOutCtrl = new ...


3

Set the center of the map to the airplane position after it has refreshed. OpenLayers setCenter


3

You may have already done these, but I have found they help a lot from my experience. Doing away with trailing (extraneous) decimals could also trim quite a bit of fat off of your json. Depending on your needs, you could go down to 2 or 3 decimal places. This all depends on scale of your map and the level of accuracy you are needing. Removing white space ...


3

Here you go. You just call the update method on the outside div, not the L.control element. I used JQuery for easier selection of the div.


3

Well, if you've got a table that natively (sorted by FID or ObjectID as applicable) is NOT sorted how you want it, and you want to view the table sorted by a specific field(s) with a unique ID field in order of the sort, you don't need to mess with any scripting at all. Just use the SORT geoprocessing tool that is included in ArcGIS (In ArcToolbox > Data ...


3

I'm not sure if this is the right way to do it, but there is a spatialreferences attribute of the WMSLayer object that contains a list of numbers that represent what to request from the backing server. If you insert 900913 as the first element: var wmsService = new WMSLayer(wmsAddress, { resourceInfo: { extent: extent, layerInfos: [new ...


3

It's not possible to change SQL or CartoCSS of a visualization with private data. The reason is pretty clear: if we allow to change SQL any user could read somehow your data. So to cover your use case we introduced the concept of template maps. That allow you to create maps with hidden sql and cartocss but with some configurable parameters. Basically it ...


3

Ok. Finally with doing some tests I was able to figure out where the problem was. KML structure does not have a Featurecollection type in its structure like the one that GeoJSON has. Instead, all you need to do is to store each feature in a separate placemark tag. This means that KML does not support multiple feature information in one placemark tag (which ...



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