Tag Info

New answers tagged

0

I resolved the issue by this answer on askubuntu.com: The apache2 version that was published when the Ubuntu 14.04 release was made is 2.4.7 and starting with this version it seems that, for security reasons, the new root directory for the server is: /var/www/html So, from now, here you must to place the files for your (local) website. And like this you ...


0

You can turn off navigation via the mouse scroll wheel. The map has a boolean setting for it and functions to enable and disable it. Your code would look something like this: function openMapTab() { ... map.enableScrollWheelZoom(); } function openNotTheMapTab() { ... map.disableScrollWheelZoom(); }


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" ...


0

ran into some problems with the = signs. this is working for me var customStyleFunction = function(feature, resolution) { if(feature.get('WELL_CLASS')=== 'EXISTING') { strokecolor = '#020815'; } else if(feature.get('WELL_CLASS')=== 'PROPOSED') { strokecolor = '#f61212'; } else if(feature.get('WELL_CLASS')=== 'INJECTION') { strokecolor = ...


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

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 });


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

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();


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.


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 ...


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


2

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 ...


0

You could probably use PostgreSQL aggregate functions to solve this. Assuming your columns are strings, you could just use string_agg(expression, delimiter) on the query in order to retrieve several columns in just one row.


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

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 ...


0

Your code snippet would work if a reference to the map object was added to the DOM element using jQuery's data function. With something like this: $('.my_map_class').data('openlayers', mapObject); But OpenLayers does not do that for you. (OpenLayers is not even based on jQuery.) So if you want to get a reference to the map object from the DOM element ...


1

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


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 ...


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

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


0

There is a node.js module and not just for ogr and osr but for the whole of gdal. You can find the repository here.


0

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);


0

Late response, but should it not be an Array of Graphic objects and it might be wise to add callback and errback functions even if they are optional, to get information on the error that occurs. https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#applyedits


0

In general, the library will not render data that is not shown in the viewport, but if there is a huge amount of data it might be taking some time to retrieve it and parse. Can you open a web-inspector and see how long it takes to get the data? And see if the profiler gives you any other info? I don't know how OpenLayers handles KML, but you could also ...


0

Your code to create the legend: var legend = new Legend({ map: map, layerInfos:(arcgisUtils.getLegendLayers(response)) }, "legendDiv"); legend.startup(); is running before the createMap response is available. It needs to be inside your the function that runs when mapDeferred is resolved like so: var mapDeferred = ...


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.


0

Download the v3.0.0 distribution from https://github.com/openlayers/ol3/releases , then copy the js file(s) inside the build/ subdirectory to your webserver.


1

Selections with multiple polygons are kind of tricky in OpenLayers 2. You have to check for every markers if they're within every selected polygon. With more markers, this can slow down the application drastically. There might be an easier way to do this, however this is my solution for your problem: function updateFeatureTable(featureList) { var wkt = ...



Top 50 recent answers are included