Tag Info

New answers tagged

0

Try this: var iconStyle_line = new ol.style.Style({// My style definition fill: new ol.style.Fill({ color: 'rgba(221, 99, 0, 0.5)' }), stroke: new ol.style.Stroke({ color: 'rgba(221, 99, 0, 0.5)', width: 3, lineDash: [4,4] // <--------- Here is the change. first line then space. etc }) });


0

I tried Terry's (thank you!) solution on my MAC and on my PC (windows). Terry's solution works fine on windows, although slower than on more recent versions of QGIS. Make sure to download the 32 bit version of QGIS! As stated by Terry, the 64 bit version will not work with the openlayers plugin. For MAC users, QGIS can only be downloaded in the 64 bit ...


1

After seeing underdark's comment, I tried using Ubuntu with QGIS 2.4. At first it didn't work, but after reinstalling openlayers, I was able to load Google Satellite and zoom in. But I couldn't zoom in past 1:2300 on Bing maps. So I did some more searching and found a post on QGIS project wiki - http://hub.qgis.org/issues/11728#change-58357 - that ...


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


0

I ran into something similar a couple of weeks back and enabling CORS took care of it for me. there are step by step instructions here http://enable-cors.org. this is the advice I recieved: You may not want to allow cross-domain requests from all hosts, so you could set the value of the Access-Control-Allow-Origin header to the host of your ol3 ...


0

I had a similar problem recently on a project and implemented a proxy in PHP on the main web site to make the WFS query to my Geoserver on another URL. The issue was definitely CORS related .. Proxy can be see at https://raw.githubusercontent.com/eslachance/php-transparent-proxy/master/proxy.php


0

I solved the problem: re-project the wms layer in ArcMap to WGS_1984_Web_Mercator_Auxiliary_Sphere(epsg3857). use this code: var map = new OpenLayers.Map({ maxScale: 1/5000, minScale: 1/500000, projection: new OpenLayers.Projection("EPSG:3857"), displayProjection: new OpenLayers.Projection("EPSG:4326"), ...


0

It actually turns out that this is not an issue with projection or map size or anything to do with open layers, really. It appears that bootstrap was adding an attribute to the image causing it to never exceed a certain width on the screen.


0

As in this answer - you can grab a list of your Vector layers directly, simply by stating your target class type: map.getLayersByClass("OpenLayers.Layer.Vector")


0

That doesn't quite match what I see in the WKT in the link I sent... and did you try just adding (preferably with corrected lon_0, x_0, and y_0 from WKT mentioned in my comment) # Swiss Transverse Mercator <3847> +proj=tmerc +lat_0=0 +lon_0=15.80827777777778 +k=1 +x_0=1500000 +y_0=0 +ellps=bessel +units=m +no_defs no_defs <> to the epsg file? ...


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

Your for loop will not be entered, because you are trying to get the length of mapPanel.map, which will be undefined. Try to get the length of mapPanel.map.layers instead: listeners: { 'select': function(combo, record) { for(var i = 0; i < mapPanel.map.layers.length; i++) { var myLayer = mapPanel.map.layers[i].name; if (myLayer == ...


2

By default a WMS layer is considered to be an opaque base layer in OpenLayers. This means you can only see one at a time, to change this set isBaselayer: false So for example: var build_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://localhost:8090/geoserver/wms/wsNYCRoad", {layers: 'building'} {isBaselayer: false, ...


1

Ok, problem solved. Like I said early, the problem was in the resolutions, or better, in the zoom. If you use a max resolution or an array of resolutions(along with restricted extent), OpenLayers will ask to the server for the first set of tiles, which is not what I wanted. To fix the problem, you must tell the server that you want to start from the set of ...


0

You could also try the Full Text Search PostgreSQL capabilities and that would still match your architecture (OL, GeoServer and PostgreSQL). Here you have a very nice resource on PostgreSQL FTS: http://blog.lostpropertyhq.com/postgres-full-text-search-is-good-enough/ According to it, you should build a GiST (and not a GIN) index because it works better ...


0

If I understand the problem correctly, there are two ways to solve the problem. 1) First, you can configure IIS to allow CORS. Here's a link on how to do this. Basically, you have to add these lines to your web.config file. <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <httpProtocol> ...


0

You need to find the correct name for the layer you are trying to load. Try a getcapabilities request to the service like so: http://demo.opengeo.org/geoserver/wfs?request=getcapabilities Then search for 'countr' to find whether there are any layers with country geometries for you to use. Edit: I made a little JSFiddle for the layer. Depending on your ...


1

You can use ESRI imagery in QGIS, just add it as a WMTS: Add WMS/WMTS Layer > NEW > enter a Name and the URL below, press OK > Connect > select a Tileset and Add it to the map http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/1.0.0/WMTSCapabilities.xml


1

Basic rule for OpenLayers and WFS is that do not test with OpenLayers. With a browser you can control what happens. Some first steps to take: How many features there are in the service? http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.1.0&request=getfeature&typename=topp:states&resulttype=hits Can you get all data out in default ...


0

This code is working correctly. where vertices are the array of coordinates var feature = new ol.Feature({ geometry: new ol.geom.Polygon([vertices]) }); feature.getGeometry().transform('EPSG:4326', 'EPSG:3857'); var vectorSource= new ol.source.Vector({ features: [feature ] }); var vectorLayer = new ol.layer.Vector({ ...


4

There is no method for setting source at api, http://openlayers.org/en/v3.0.0/apidoc/ol.layer.Vector.html. However you can define source; var source = new ol.source.Vector(); and set source at the beginning; var vectorLayer= new ol.layer.Vector({ source: source }); Then you are free to add or remove features to source dynamically by using ...


0

I also have the same problem, but still can't see the the layer if I zoom. Whats wrong with my source? thanks var wms = new OpenLayers.Layer.WMS( "Földrengések", 'ujProjekt/wms', { layers: ['rengesekk'], isBaseLayer: false, transparent: true, srs: "EPSG:4612", numZoomLevels: 12, }, {singleTile: true ...


0

My approach using regular expressions directly on the WKT string function validateWKT(wkt){ var match = wkt.match(/\d+\.\d+/g); for(var i=0; i < match.length; i=i+2){ if((match[i] > 180) || (match[i+1] > 90)) { return false; } } return true; }


1

KML coordinates are in EPSG:4326 by definition. WKT lacks any concept of CRS whatsoever, encoding just the geometry type and its coordinates. So there is nothing within the format's themselves that would allow you to force coordinates into EPSG:4326. However, as virtually all other terrestrial coordinate systems will use meters (or incredible, as it may ...


0

I probably find the answer or at least a point to start from. There is already work done on serving on the fly a spatial layer through geoJson. https://github.com/bmcbride/PHP-Database-GeoJSON In my case I will change the code so as get the layer attributes from the db & the location from the external gazetteer & build on the fly a GeoJSON ...


0

Only hint as you do not provide enough information ratio and serverType must be in the source not in the ol.layer.Image (See http://openlayers.org/en/v3.0.0/apidoc/ol.source.ImageWMS.html)


0

I found the solution by replacing the function imagecopymerge_alpha given in http://trac.osgeo.org/openlayers/wiki/TileStitchingPrinting by the following function: function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct) { // creating a cut resource $cut = imagecreatetruecolor($src_w, $src_h); // copying ...


1

You can try using GDAL2Tiles. It is a small utility that will convert your GeoTIFFs into a directory structure of small map tiles which you can just copy to your webserver. Once installed, you can use it like so: gdal2tiles --profile=mercator -z 1-8 yourmap.tif outputfolder This command will generate tiles from zoomlevel 1-8 outputfolder. You can then ...


0

That is not an error. The data are points also for WMS but the advanced SLD with transformations creates a visual presentation with contour lines on-a-fly. The purpose of WFS is to deliver data as they are natively and therefore you are getting points. Data processing like generating contours from points is something for Web Processing Service (WPS). Read ...


1

Using the WMSGetFeatureInfo method, the way to pass along viewparams is by using vendorparams and and assigning the viewparams in the eventlistener before the callback function retrieving the "click result" from the WMS layer click_info = new OpenLayers.Control.WMSGetFeatureInfo({ title: 'Identify features by clicking', layers: ...


1

Ok, thanks to everybody for comments. Actually trying to add the example to jsfiddle helped to find the problem. The page was running ok on jsfiddle and when comparing the jsfiddle source code with the original, I found the problem The code snippets posted above are ok, the problem was in the (missing) first row. After adding "<!DOCTYPE html>" in ...


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

The documentation for params is correct when it says: "At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically.". So when you want to set SLD_BODY, you also have to unset STYLES: source.updateParams({STYLES: undefined, SLD_BODY: ...


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

I solved problem. My layers are created with sql view. When I zoom in level 10 other layers are appearing and one of them is duplicated column name. I get wms request result error like this: Rendering process failed↵java.io.IOException↵null↵ERROR: column reference "name" is ambiguous↵ Position: 117


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


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


3

The final answer is: your vector data is out of range. There were two problems with your map. The first was, that your dataset contains three coordinate for every point, while OpenLayers 2 can only handle two. To fix this, you have to include an ignoreExtraDims parameter to your format object: format: new OpenLayers.Format.GeoJSON({ ignoreExtraDims: ...


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


1

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



Top 50 recent answers are included