Tag Info

Hot answers tagged

3

Feature creation can be kind of tricky in OpenLayers 3. There aren't any official examples for ol.source.Vector layers, most of them are working with GeoJSON, or some other data exchange format. I have managed to create a working fiddle. Let me explain some of the key aspects of achieving your task. var layerLines = new ol.layer.Vector({ source: new ...


2

You don't say how you are opening your JS script in FireFox. I believe this layer type is using Ajax calls. You cannot open the file with file://myfirstmap.html. You have to use a web server to view the map. The problem that you will face with OpenLayers is that some formats like the text/tab/csv format does not use Ajax calls. So you start with these ...


2

You can get this from the FeatureLayer class. There is an attribute called fields, which is an array of Field objects. The Field class has domain attribute. The following will output the domains in the console (if any): var map = new Map(...); var fl = new FeatureLayer(...); map.addLayer(fl); // when layer is ready for (var i = 0; i < fl.fields.length; ...


2

You have to wait until the map is ready to have those methods attached to it. This disables the navigation. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Simple ...


1

As per the response syntax and example in the documentation here, ArcGIS Server should definitely be returning the spatialReference to you explicitly. see this thread for more info about the confirmed bug.


1

If the features are points use var coord = event.feature.getGeometry().getCoordinates(); For point geometries getCoordinates returns an array of 2 numbers. The first number is the x coordinate. The second number is the y coordinate. And if you want to convert coord to a longitude and a latitude use: coord = ol.proj.transform(coord, 'EPSG:3857', ...


1

I think your problem is related to this question, this answer and this bl.ock. at least one issue is that you haven't defined #infowindow_template, but you can get a simple onclick popup of the country name by adding the following: cdb.vis.Vis.addInfowindow(map, layer.getSubLayer(0), ['name']); in place of: sublayer.infowindow.set('template', ...


1

Internally OL3 uses Google Closure XhrIo to load data in vector layers. OL3 philosophy has changed, now is a more concrete library, mainly oriented for gis mapping, instead a general purpose library like OL2. OL3 leave to the user tasks like AJAX request. You can make them using XMLHttpRequest or through any other library like jQuery or Google Closure.


1

For a few "markers" a solution can be implement them as overlays and use CSS3 or SVG to animate them. See example: http://acanimal.github.io/thebookofopenlayers3/chapter06_markers_overlays.html Take into account overlays does not offers a great performance, as you can see in the examples, when many overlays are animated.


1

Geometries especially polygons will be are to place in Streetview mode (Earth API would be better). But Images can be overlayed into streetview This simple demo shows how to display an image overlay over a streetview and sync its movement (approximately) as the street view POV (point of view) changes This source is available from 'http://teammaps.com/' ...


1

How can I pass the value from the HTML/JavaScript to the PHP file where I have the connection with database? If you use jQuery, you can use an AJAX call like this: $.ajax({ data: {lat : lat, lng: lng}, type: "POST", url: "script.php", success: function (e) { alert(e); }, error: function (er) { ...


1

You just need to add an event listener on the draw variable draw.on('drawend', function(e) { e.feature.setProperties({ 'id': 1234, 'name': 'yourCustomName' }) console.log(e.feature, e.feature.getProperties()); }); Be aware that there is a a function setId on e.feature but this "id" is a bit different from the one you set in the attributes ...


1

After searching a little deeper, I just remembered that vector layer in OL is drawn on canvas. So it's easier to work with since HTML5 canvas has the 'color-blend' property called globalCompositeOperation. //First get the DOM Element of the layer var div = document.getElementById(buffer_layer.id); //Then get the canvas element; //it returns an array, so ...


1

You can't turn the layers in a layer group on and off independently. If your client needs to turn layers off then you need to request them separately in OpenLayers.


1

i'm not sure why .disableMouseEvents() stopped working after 3.9, but you can use map.setInfoWindowOnClick() instead. here's a working sample.



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