8
votes
Why doesn't Leaflet have cross-origin error when adding WMS layer from GeoServer, but GetFeatureInfo using ajax does
Because that is the way CORS works! loading images is always (mostly) a safe operation so the browser doesn't care where you get them from. Loading a script (javascript or xml) is potentially ...
4
votes
Accepted
Geoserver Printing Module | MapFish print service won't print
I had similar issue. Did exactly like you did. Later, I used GET and solved the issue. You just need to use encodeURI() before passing your json as the spec parameters. Try following:
$("#export-...
4
votes
Accepted
Wait until geoJSON ajax call completed
The following is the fallback function for data loading:
layer_kos.on('data:loaded', function() { })
More can be found in the doc
4
votes
Accepted
MarkerCluster don't work with geojson layer in leaflet
From your above additional code, it looks like you are loading Leaflet.markercluster script before Leaflet script:
<script src="leaflet.markercluster-src.js">
<script src="http://code.jquery....
4
votes
Displaying GeoJSON using Ajax and Leaflet?
There are several things that have to be corrected.
First thing is wrong path to ajax library leaflet.ajax.min.js. Error 404 for file webmap101/htdocs/webmap101/leaflet.ajax.min.js tells you that ...
3
votes
Accepted
Uncaught SyntaxError: Unexpected token < (Geoserver popup in leaflet using ajax)
The problem is in the url string.
It had two problems:
Additional comma at the end of layers parameter as suggest by @Stefan in comments
&layers=workspace%3AlayerA,workspace%3AlayerB,workspace%...
3
votes
Executing functions after multiple data sources have been loaded in Leaflet AJAX
According to the docs there is a function L.Util.ajax that returns a promise. So this should work (is untested)
data_layer1=L.Util.ajax(data1.geojson,{options});
data_layer2=L.Util.ajax(data2.geojson,...
3
votes
Accepted
Displaying nonspatial data via spatial data in Leaflet
In your globalArrayJobsCID, you just push the cid, not the associated value. And I guess you actually want to show that value (i.e. an item from your data), not the cid itself (or not only that).
...
3
votes
"Unsupported GeoJSON type" from AJAX request to PostGIS database
JavaScript will not wait for the ajax call to return before continuing processing your code. The only thing that will happen once the Ajax call is completed is success: function (resJ) { res = JSON....
2
votes
GeoJSON interaction with leaflet
I think it is a asynchronous issue: your function $.getJSON does not ends before the remainder of the code is executed. Therefore, the object people actually doesn't exist when your code want to use ...
2
votes
Accepted
Collect external geojson from user and pass to L.GeoJSON.AJAX()
Your "working" Pen has unassigned qom variable, and L.GeoJSON.AJAX('#loadButton') is definitely not going to work, as '#loadButton' URL will not provide a valid JSON data.
The thing you must ...
2
votes
Add multiple WFS layers to Leaflet map from GeoServer using JQuery Ajax calls
It turns out that I think JQuery is re-using the callback function name "getJson". To avoid this, I create callback function names for each layer using the actual GeoServer layer name. My layer ...
2
votes
Accepted
Leaflet create marker from ajax call data
Most probably your data is still string type, which is not suitable as input to Leaflet Marker factory L.marker.
From your code and data sample, jQuery $.get performs an AJAX request and treats the ...
2
votes
How can I show a popup in a map, using Leaflet?
Here is a working example, for points. I used JQuery to get the data from my external GeoJSON file. Note You need it running from a server or localhost if your using an external data file. In this ...
2
votes
Accepted
Displaying geojson polygon in leaflet imported with ajax
It turns out my problem was related to Configuring Cross-Origin Resource Sharing (CORS)on the Google Cloud bucket. I needed to add the domains that hosted my source geojson file. I used this ...
2
votes
Generate and add L.control.layers from GeoJson properties to Leaflet
You're creating new markers right here:
overlays[destination] = new L.GeoJSON(null, {
Just don't. Refer to the existing instances instead.
2
votes
Searches by area names in OpenLayers with request of AJAX in the PostGIS database
Try something like this:
var feature = yourVectorSource.forEachFeature(function(feature) {
if (feature.get('id_teren') == id_teren) return feature;
});
if (feature) {
feature.setStyle(...
2
votes
Accepted
Load data from URL to update Billboard position Cesium
For anybody who might be having an issue similar to me i have found a solution based on a tutorial from https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html.
My solution based on ...
2
votes
Accepted
Executing functions after multiple data sources have been loaded in Leaflet AJAX
One possibility would be to use setTimeout function to check when all three layers are loaded, something like this:
var layer1Loaded = false;
var layer2Loaded = false;
var layer3Loaded = false;
...
2
votes
Accepted
Heatmap with GeoJSON, Leaflet and Leaflet.heat plugin
Instead of GeoJSON object you are passing Leaflet layer as first parameter to geoJson2heat function (see https://geomappando.com/2016/11/08/come-realizzare-una-heatmap-con-leafletjs/).
You don't need ...
2
votes
Leaflet Feature bindpopup does not display (OnEachFeature)
Instead of using the L.GeoJSON.AJAX method of loading in my data, I have opted to use $.getJSON as shown here. I was able to then load the popup at a later line using L.geoJSON and add my '...
2
votes
Accepted
Leaflet Feature bindpopup does not display (OnEachFeature)
L.GeoJSON.AJAX object is an extension of Leaflet L.GeoJSON object and so it inherits all it's options (this is not explicitly mentioned in leaflet-ajax plugin docs). This means it's possible to use ...
2
votes
Accepted
How to tie an ArcGIS Server QueryTask result back to the calling layer?
You can do this by sending the LayerName along with the QueryTask to a separate function.
for (layerDef in config){
var queryTask = new QueryTask({url: config[layerDef].url});
var query = new ...
2
votes
Accepted
Popup for each feature when using Leaflet marker.cluster plugin
If you want to have popup for each layer, you have bind it to each individual layer, not to the cluster:
var my_data = new L.GeoJSON.AJAX("http://127.0.0.1:8000/my_data/",{
onEachFeature: ...
2
votes
Problem with put sld in geoserver
Your SLD input file is invalid - there is no Stroke element for TextSymbolizers so GeoServer discards those elements when it parses your input file to convert it into a style.
The "extra" ...
2
votes
Accepted
General JavaScript function handling popups of various JSON layers in a Leaflet map
There are several things wrong in your approach. First thing that is wrong is that comparison in JS uses == or ===, single = is used for assignment.
Second thing that is wrong is the way you define ...
2
votes
Converting from esoteric coordinate systems to EPSG:4326 WGS 84
The EPSG:3081 NAD83 / Texas State Mapping System is supported by MyGeodata Cloud Converter so you can upload your Shapefile there, set EPSG:3081 as input coordinate system (if it is not recognized ...
2
votes
Accepted
Multiple WFS layers in Leaflet, loaded with Ajax with bounding box, do not display correctly
There are three things you have to take care of to make it work.
The main thing is using different name for each jasonp callback when retrieving WFS data. Since calls to get WFS data are async, when ...
2
votes
Can't get OpenLayers vector layer to display (loaded by AJAX)
Resolved... the problem is where the projections are defined. When using loader, the geojson reader needs this:
var features = geoJsonFormat.readFeatures(data, { ...
2
votes
AJAX calls for leaflet
Two things have to be corrected in the above code.
ArcGIS service for UNESCO sites returns geometries as points, so you have one dimension to many when getting site coordinates. It should be:
var lon =...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
ajax × 119leaflet × 53
geojson × 41
openlayers × 27
javascript × 26
geoserver × 25
wfs × 19
jquery × 18
json × 10
php × 10
openlayers-2 × 7
arcgis-maps-sdk-javascript × 6
postgis × 5
postgresql × 3
geocoding × 3
clustering × 3
popup × 3
getfeatureinfo × 3
qgis × 2
arcgis-server × 2
wms × 2
layers × 2
extents × 2
google-maps-api × 2
markers × 2