Tag Info

Hot answers tagged

4

If you want to have different visualisations but only modifying your query params, for instance because a filter changed and you want to change your where from WHERE somefield = 'x' to WHERE somefield = 'y', probably you want to have a look at the named maps + templates functionality provided by the Maps API. That allows you to create visualisations without ...


3

According to this maths is fun page, or the wikipedia steridian article, you will discover that there are 12.56637 steradians in a sphere. So, if you take the area of the earth to be, 510,072,000 sq km, then, given your area of 8.101249039703731e-8, and plugging in these numbers, you get: 8.101249039703731e-8 / 12.56637 * 510,072,000 = 3.288 kmĀ². or in ...


3

I don't know of any built-in functionality or plugins for this, but here is a solution that should get you started (using jQuery). In short, because the Layer Control is generating dynamic html, we use jQuery to select the leaflet control layers overlays, and add a description. Then make use of these built in Leaflet map events to show and hide the ...


3

We use a trick like: <style type="cartocss/text" id="simple"> #earthquakes_cdbjs_lesson3{ marker-fill: #FF6600; marker-allow-overlap: true; ... } </style> and after that cartocss: $("#simple").text();


3

Here's an example that accomplishes what you want (I think): http://jsfiddle.net/tschaub/Lkgx0qaa/ I've created a map with three layers, only the first one (named roads) is visible: var roads = new ol.layer.Tile({ source: new ol.source.BingMaps({key: key, imagerySet: 'Road'}) }); var clipped = { imagery: new ol.layer.Tile({ source: new ...


2

this is the sample you should start by taking a look at. in general, you need to use esriRequest to fetch your data, and then parse as appropriate before passing to a FeatureLayer or creating your own graphics and adding them to the map.


2

You need to initialize your map object. See the source code here for an example: http://leafletjs.com/examples/quick-start-example.html Add something like this to harris.js before you call map.on. var map = L.map('map').setView([51.505, -0.09], 13); What's happening is map.on is undefined. Map itself is not defined in JavaScript, but by default DOM ...


2

Since Github supports CORS, you can use jQuery's getJSON() or a micro-library like corslite to grab your geojson without altering it. Here's a working example using $.getJSON() (notice that I took out your script tag referencing your geojson file): <html> <head> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" ...


2

Your github file cannot just contain a value; it must define a variable that will be defined when the file is included as javascript. var geojsonFeature = { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, .... }; Then you can use this variable as an input to your GeoJSON layer var ...


2

You need to change the scope of your view so it's available to those listener events. Just make a the view global by declaring it outside the Map definition. See http://jsfiddle.net/4gjhwbne/ i.e. change var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.MapQuest({layer: 'osm'}) }) ], view: new ...


1

I guess your problem is one of Javascrip variable scope. The variable layer_1 is only visible in the init() function, so you cannot access it outside of that function. A solution is to declare it global, that is add to the line var map, layer so this reads var map, layer, layer_1; // and layer_2,... and then use the global variable in the init ...


1

Try this change to your layer definition: var wellsLayer = new ol.layer.Vector({ source: new ol.source.GeoJSON({ projection: 'EPSG:3857', url: 'data/WELLS.geojson' }), style: customStyleFunction // "style:" is inserted and ',' is removed });


1

The thing is that the legend of a wms service is actually an image. Having said that how can you display an image inside the tree? what I usually do is either use the Legend Panel, which i can understand is neither handy or neat or use an event to manually get the legend of the layer and display it somewhere more handy. for example: ...


1

I found the solution, here it is for it is helping anyone Following this answer http://gis.stackexchange.com/a/118818/42868 There is an unstable option for the ol.source.GeoJSON object, so adding it in this way made it work var source = new ol.source.GeoJSON({ url: 'geojson url', projection: 'EPSG:3857' });


1

Yes, you can do it with CartoDB.js. This link will help you: http://bl.ocks.org/xavijam/378c6dc0d43654280757


1

I use squel.js to create SQL queries in javascript. It's pretty straightforward + lightweight to boot: http://hiddentao.github.io/squel/


1

After the container size is changed you have to update the map size and recalculate bounds: map.updateSize(); You can check the OL documentation http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.updateSize


1

I have tried everything with my (unfortunately limited) JavaScript knowledge to set the clip dynamically on the selected layer. I couldn't manage to save and restore the whole canvas context, neither the layer's one. I have tried to unbind the event from the layer, no luck. Neither strUser.un(evt, func) or evt.stopPropagation() worked out. For this, I ...


1

The popup is printing the text just as you have written it. Use javascript variables in marker.bindPopup, not php: marker.bindPopup(data[i].name + "<br>" + data[i].user_date + "<br>" + data[i].user_time + "<br>" + data[i].address + "<br>" + data[i].icon_name).addTo(map);


1

Perhaps did you forgot to separe variable declarations? I point to this: var max = new Date(range.max).getTime() var min = new Date(range.min).getTime() and var start = new Date(ui.values[0]).toISOString() var end = new Date(ui.values[1]).toISOString(); There are no ; separating both sentences. PS: I couldn't debug it because there was no viz.json ...


1

I was having the same issue than you, and then realize that it was a problem on the data. In order to log those errors on the console, you have to put: omnivore.csv('your_file.csv', null, L.mapbox.featureLayer()).addTo(map) .on('error', function(error) { console.log(error); }); And it will tell you which line is not working, such as an invalid lat ...


1

This one uses REGEX based US address parsing: http://search.cpan.org/~timb/Geo-StreetAddress-US-1.04/US.pm And it's javascript port: https://github.com/hassansin/parse-address. You can probably do the same for other countries.



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