Tag Info

New answers tagged

1

It's because you are using options in the wrong place: Refering to the API doc ol.Attribution accepts only html as an option. You have to change the default control for attribution and it's done using an ol.control.Attribution. See the doc about this control. You should create a new control like below (borrowed from attribution official sample) var ...


0

Okey, maybe I found a better way using map.event.register map.events.register("zoomend", map, function(e){ // after zoom }); map.events.register('moveend', map, function (e) { // after pan }); then to find corner latlon after it, I can use Map function map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)); // corner bot-lef ...


0

I can see that this question is similar to How to Start Web Mapping?, but it is slightly different since the OP has zeroed in on a Stack; Hence I think it merits an proper answer. All of the softwares that you mentioned, work with each other, and truly understand them, you should learn them simultaneously. I'll recommend that you start with this Penn ...


0

The short answer is that you can't do what you're trying to do. OpenLayers requires that you pass in a URL to a WMS endpoint e.g. http://my.host.com/cgi-bin/mapserv?map=mywms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities In your example above you are pointing to a MapServer map, not a WMS endpoint. The next problem is that I don't ...


1

You will need to repeat some of the code to get more than 1 layer, such as: 1) create another ol.source.TileWMS and set your layer name in the params (https://github.com/boundlessgeo/suite/blob/master/sdk/src/main/resources/client/ol3view/src/app/app.js#L42:L47) 2) create another ol.layer.Tile and link to your source from step 1 ...


0

Maybe this is a different workaround than you are thinking, but when I have had issues with the Google Maps plugin I reprojected my data into EPSG:3857 and then did all my work there, then I reprojected it back to the original projection once I finished. I've also realised when working with the plugin that sometimes the projection renders a little wonky ...


1

I finally made it with a little extension of the ol.Map object: if (ol.Map.prototype.getLayer === undefined) { ol.Map.prototype.getLayer = function (id) { var layer; this.getLayers().forEach(function (lyr) { if (id == lyr.get('id')) { layer = lyr; } }); return layer; ...


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.


2

This is currently the case, see: https://github.com/openlayers/ol3/issues/2907 for the relevant discussion


4

Trying to find a solution, I've changed OpenLayers.js file, provided by plugin authors (which had 'Release 2.11' version in his body and was placed at ~/.qgis2/python/plugins/openlayers_plugin/weblayers/html folder in my system) to last 2.13.1 version from official OpenLayers site (pay attention, 2.+ version!). Just download the archive, extract to ...


0

I solved it by using this way Change curl_setopt($ch, CURLOPT_PUT, true); to curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");


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


0

Ok, I found where was the problem. Of course, you have to specify which kind of protocol to use, so the correct syntax was: protocol: new OpenLayers.Protocol.HTTP({...})


0

Found what was the problem. Following that example, I thought that that syntax was referring to properties inside OpenLayers. Instead it wasn't. Where you have to indicate the style, you have to put the name of the namedLayer of your sld, like so: var format = new OpenLayers.Format.SLD(); OpenLayers.Request.GET({ url: 'style/roadsStyle.xml', ...


0

In order to render this as a polygon, you need to enclose the coordinates in an additional pair of square brackets: lr = new ol.geom.Polygon([[ [aoi.west, aoi.north], [aoi.east, aoi.north], [aoi.west, aoi.south], [aoi.east, aoi.south] ]]).transform("EPSG:4326", "EPSG:900913")


0

At OpenLayers Cookbook code examples (http://acanimal.github.io/Openlayers-Cookbook/) there is a working example, see "Chapter7 - Styling - Improving style using StyleMap and feature's attributes replacement". Create your style intent without using rules, really you are not using them because you are not setting any condition to filter. For example try ...


1

Avoid using capitalised letter within textAlign and textBaseline, the values must be in lowercase. Next example, fixing that issue, works fine: http://jsfiddle.net/dL3h58a9/8/


0

The following is a modified version of what has been working for us. You'll need to supply your own logic for setting the specific style. In our situation, we base the style on the layer name using a series of if/else statements. import os from geoserver.catalog import Catalog """ geoserver_username - the username of the server geoserver_password - the ...


0

Well, took me a couple of hours but I found one way to do it. It requires you to use dojo.js, (which unfortunately I can't use for my project but thought I'd share for anybody else that's looking). Basically, as I understand it, dojo adds a custom wrapper to openlayers map which allows you to add Dojo GFX Shapes and Widgets - which includes Pie Charts! ...


0

Don't tested but try setting it as a new parameter on L.TileLayer.WMS. At least the code seems does not filters parameters (https://github.com/Leaflet/Leaflet/blob/master/src/layer/tile/TileLayer.WMS.js). On the other hand, it is also better you configure your WMS server to solve the problem at servir side. This way no matter of client you will not have ...


1

You could get the geometry by joining your query result's id2/edge with your layers's geometry ID (gid): SELECT s.seq, s.node, s.edge, s.cost, b.gid, b.geom FROM ( SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra(' SELECT gid AS id, source::integer, target::integer, ...


1

Following the 2nd example from ST_MakeLine, you could join the nodes from your routing output, to nodes representing a Postgis point, and use this to create a line, something like: SELECT ST_MakeLine(gm.the_geom ORDER BY rt.seq) As route_geom FROM route rt inner join geometry gm on rt.node = gm.node ; where route is the output from pgRouting and geometry ...


1

had the same problem and found no tools that would give me the solution, so what i did was take the LineString (which is not the feature, but the feature's geometry => feature.geometry), get its vertices and store them in an array (points) function onFeatureSelectLineString(event) { var feature = event.feature; var points = ...


2

http://localhost/ will be interpreted by the WMS server as its own host, but the SLD you want to use is on your app's host (let's say http://myapp.com/. So yo will have to change your SLD URL to the app's public URL (using its FQDN), e.g. http://myapp.com/style/point.xml: { layers: "PGS:geopoint", transparent:true, style:"", ...


1

Here is a post I have written regarding how to achieve this, I have covered many things including web-sockets here. http://yasassriratnayake.blogspot.com/2014/09/developping-web-bases-realtime-updating.html


0

my strategy (very resource intensive) is to listen to mousemove and constantly saving x and y values in global variables. var mouseLat, mouseLon; function init(){ ... map.events.register("mousemove", map, function(e) { var position = this.events.getMousePosition(e); var lonlat = map.getLonLatFromPixel(position); var lonlatTransf = ...


0

I was also looking at this trying to figure out how to make it work with the composer that comes standard with OpenGeoSuite. If you are in windows and aren't quite ready to create an app with the Boundless SDK, you can still change some of the configurations through the geoexplorer script. If you are in windows the default file location is: C:\Program ...


0

found the answer: the clustered feature (placemark) is "inside" the cluster feature, not the layer. SOLUTION 1 first way out (not most efficient): inside onFeatureSelectFeature(featureId) i loop thru cluster features as seen below: function onFeatureSelectFeature(featId) { var layerNow = map.getLayersByName('Paradas')[0]; var layerFeatCount = ...


1

Late response, but here is a talk demoing how to use vert-x, Leaflet and websockets for a real-time bus position tracker http://vimeo.com/106234599


0

it also works without needing GEvent google.maps.event.addListenerOnce(openlayersMap.baseLayer.mapObject, 'tilesloaded', function(){ alert("Map Loaded!"); } );


0

I would have added this as a comment but since I don't have the reputation I thought I'd put it as an answer. I believe that both simplification and some form of spacial indexing are used in OpenLayers 3 to improve vector performance. It may be worth giving it a try if you are currently using OL2. Source ...


0

Use the ModifyFeature control. Add your layer to the control, add the control to the map, activate the control and then call selectFeature() on the control and pass it your feature. The API makes it sound like you have to be in standalone mode but it works for me without being in standalone mode. I'm using OL 2.13.1.


0

this works for me: function onFeatureSelect(event) { var feature = event.feature; var layerName = event.feature.layer.name; var content = "unInitialized"; // alert ('selected this feature='+feature.id+ '<br/>Atributos: '+feature.attributes.description); if ( (feature.attributes.name > '') || (feature.attributes.description > ...


0

You are writing bad, it must be: xgis.map.prototype.zoom = function(action) { ... } Anyway, it is better you follow the Ol code conventions. To create subclasses you must create methods inside class definition, something like: xgis.map = OpenLayers.Class(OpenLayers.Map, { someAttribute: 'someValue'. someMethod: function() { ... } ...


0

Sometimes the solution is simple. It seems the Canvas and VML renders don't work well with holes. I switched back to SVG render and it works fine now. So the simple solution is to remove this line : renderers: ['Canvas', 'VML']


0

Problem is CORS which is not allowing the tiles to load from 192.168.1.127 I configured the proxy and now its working fine.


0

I solved it myself. To hide the icon: set the externalGraphic to null. To be able to show the correct icon again I had to assign a new attribute to the feature, with info of the original icon (in my case just a code word, retrieved from the checkbox ID). To show the icon again: check if it is null, and if so set the correct icon with the icon attribute. The ...


0

For the moment it is not possible with OpenLayers3. See: https://groups.google.com/forum/#!searchin/ol3-dev/tiles$20loading/ol3-dev/zktMTr2G4X4/uf4b3QBb-kwJ https://groups.google.com/forum/#!searchin/ol3-dev/tiles$20loading/ol3-dev/_w07WkrclsQ/nbuPvvcAQwkJ Vote for this issue at github project.


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

Why do you want to use WMTS? The GBIF website is based on Leaflet. The built-in tiles layer are not using WMTS grid at all but the OSM default grid. Normally with both OpenLayers 2 and 3, you just have to change the URL parameters when tiles are base_url/z/x/y.png but the GBIF url do not work the usual way: it requires more changes as the url uses ...


0

I have just had a quick play using the developer tools in chrome to apply display:none to hide a feature, by changing it to display:inherit, the feature reappeared. I suggest you try using: var feature = pois.features; for (var i = 0; i < feature.length; i++) { if (feature[i].style.externalGraphic == "url to icon") { ...


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


1

When inspecting your sample url, I see that tiles called are coming from https://pregeoegl.msp.gouv.qc.ca/cgi-wms/mapcache.fcgi/tms/1.0.0/carte_gouv_qc_public@EPSG_3857/4/13/28.png. I should be able to make a getCapabilities request (see http://mapserver.org/mapcache/services.html to understand how I deduced it) with ...


2

Have you done the pgRouting workshop? The workshop should clarify the following: There are import tools for OSM data, so the network will contain the routing topology already after import. If you still want to use SHP files, then it explains how. Your bus stops have coordinates, so you just need to start from the nearest point in your road network. ...


2

create coordinate list var obj={}; obj.d=[]; obj.d[0] ={}; obj.d[0].vLongitude = 45; obj.d[0].vLatitude= 45; obj.d[1] ={}; obj.d[1].vLongitude = 55; obj.d[1].vLatitude= 55; create a markers layer var markers = new OpenLayers.Layer.Markers( "Markers" ); map.addLayer(markers); and add all markers on map for(var ...


0

Ok, it seems the "icon" in my text file was not interpreted as an attribute at all, but as an externalGraphics link. Logical off course, I just didn't get it. So now I'm able to access my icons with: function hideFeatures() { var feature = pois.features; for( var i = 0; i < feature.length; i++ ) { if (feature[i].style.externalGraphic ...


2

The ArcGIS REST API hasn't been included in the OpenLayers 3 code yet. People are discussing its importance and it is expected to have an implementation in a later version. Until then, you can try to stack with an ArcGIS WMS server or use OpenLayers 2. OpenLayers 3 WMS example: http://jsfiddle.net/GFarkas/tr0s6uno/ Code: map = new ol.Map({ target: ...


2

With the fixed mapfile, it become clear to me, this is a client side problem. There is nothing wrong with the MapServer setup, the resolution limit has been set in the OpenLayers map object automatically. To override this limit, include a maxResolution parameter in your OpenLayers.Map constructor. var map = new OpenLayers.Map('map', { ...


2

It is mentioned here (at the very top of the page) that in OpenLayers 3, the functions you describe: "They have been removed and were "replaced” by style functions" They also provide a link to more information regarding those functions and how they can be used. Hope this helps.


2

Vector layers have a 'redraw' method, which can be executed after changing style. After that, only re-rendering will occur and layer data remains unchanged. For example: layer.styleMap.styles.default.defaultStyle.strokeColor = '#AAAAAA'; layer.styleMap.styles.default.defaultStyle.fillColor = '#ABCDEF'; layer.redraw();



Top 50 recent answers are included