Hot answers tagged

23

Newer versions of OpenLayers (post 2.11) should use CSS classes for this. .olImageLoadError { /* when OL encounters a 404, don't display the pink image */ display: none !important; }


9

I'm going to make the following assumptions: url = http://insert.your.url.com/path (which will be wrong) your not using any library, i.e. no jQuery, no AJAX you're interested in the built in XMLHttpRequest() object you would like to handle asynchronous requests (instead of synchronous) you can replace the error / success handler with something else you wan'...


8

You can do a post request in OpenLayers like this: var postData = ""; //insert your data to post here var request = new OpenLayers.Request.POST({ url: "http://host/path", data: postData, headers: { "Content-Type": "text/xml;charset=utf-8" }, callback: function (response) { //read the response from GeoServer var ...


6

Looking at your code you either need to: map.addLayer(wfs); or map.addLayers([wfs]); You have map.addLayers(wfs), which is incorrect, I believe.


6

For the OpenLayers.Format.GeoJSON feature collection use an OpenLayers.Layer.Vector instance. Examples from the OpenLayers Examples Gallery: http://openlayers.org/dev/examples/geojson.html http://openlayers.org/dev/examples/vector-formats.html http://dev.openlayers.org/docs/files/OpenLayers/Layer/Vector-js.html Use a zoom based strategy for displaying your ...


6

i think you can achieve this with some css bindings which is not a gis solution. in css there are lots of css media types and one of these is print element. you can add this to your index page with this way: <link rel="stylesheet" type="text/css" media="print" href="print.css"> and with some css code may help you. body { background: white; ...


6

Go through the following questions. GIS for the web Steps to Start Web Mapping Web GIS Development Skill Sets


5

The map definitions should be in the YAML file. These are then accessed through the print web service via the info.json page. http://www.mapfish.org/doc/print/protocol.html For testing you can always hardcode these parameters by creating a JSON object: var printCapabilities = { "scales":[ {"name":"25000"}, {"name":"50000"}, {"...


5

did you try this for adding some default image on image error: OpenLayers.Util.onImageLoadError = function(){ this.src = "images/blank.png"; };


5

Set the following parameters in OpenLayers: // Avoid pink error tiles OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; OpenLayers.Util.onImageLoadErrorColor = "transparent"; Reference document/tutorial: http://workshops.opengeo.org/stack-intro/openlayers.html Please note that 3 is a very high-tolerance value for reload attempts IMHO and could be lowered to just 1.


5

When you unzip the file, there is a 135 kB minified GeoExt.js in the GeoExt/script folder. The Development version is present at the GeoExt/lib/GeoExt.js location, while the compressed & minified version is located at GeoExt/script/GeoExt.js.


4

Have a look to see if there are any columns in your database named "addr" or similar. If there are then you may be able to query the database directly and isolate these rows. If not, you probably need to create a database schema with address tags included from scratch. Broadly how I might go about doing it is as follows: Run the raw .osm datafile through ...


4

The correct url for the legend graphic for each layer and style is embedded in the GetCapabilities response as the LegendURL element. To get it: fetch the capabilities xml document parse it (OpenLayers has a parser class) retrieve the LegendURL for each layer you're interested in Alternatively you can build a GetLegendGraphic request by following the ...


4

Finally I am able to fetch LegendGraphic. from this post. All I had to do is loop through all my layers, and then set the legendURL. var layers; for(var i = 1; i < map.layers.length; i++) { layers = mapPanel.layers.getAt(i); layers.set("legendURL","http://my-ip-address/geoserver/wms?TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&...


4

you can achive this with immediate measures and OpenLayers Measure Example will help you about your que. Dont forget to check measure distance and use immediate measures... i hope it helps you


4

There may be an easier way of going about this - but the only way I have found to label vector layers in a GeoExt LegendPanel is to give them a style rule with a name. So for styles that dont require rules, i just add one elseFilter rule (so it will always match) and put the name of the layer / feature in its rule oject: new OpenLayers.Style( { ...


4

GeoExplorer is written using Ext JS 3.4 and Geo Ext Js Libraries. Try this tutorial from Open Geo. With this tutorial you will create similar app


4

Regarding the comment about two separate labels (one for the "rest of the map" and one for the labels): this is what I thought of as well, and it should be fairly easy to implement: var url = "http://myserver.com/wms"; var background = new OpenLayers.Layer.WMS( "Base Map", url, {layers: 'background'} ); var labels = new OpenLayers.Layer.WMS( ...


4

Please check timeline plugin on GitHub. I am sure it will help you. It contains simple library to create a time related map with Open Layers. It supports cluster strategy (Open Layers.Strategy.Cluster) and time filtering. Currently it supports source data in GeoJSON or GeoRSS format.


4

I think this could be by two reasons: You must set the plugin parameter paging to false to show data always, not depending of the map view. In other way you can take a look at the Geoserver layer to set the parameters "Encuadre Lat/Lon" properly ( sorry i don't know the parameter name in english) . Try like this: { ptype: "gxp_featuremanager",id: "...


3

It Just Worked For Me OpenLayers V2.13.1 .olTileImage.olImageLoadError { display: none !important; }


3

I would argue that the JSAPI already provides equivalent functionality to what's in GeoExt. All of the additional widgets provided by dojo are just a require statement away. It's up to you how you use them. Here's an example of a JSAPI site that has always struck me as having a "GeoExt feel": http://uplan.utah.gov/ For your specific case of a tooltip on ...


3

To get the number of features from a layer in the server you need to use the WFS (Web Feature Service) request. You will need to call GetFeature and set the parameter resultType to hits (resultType=hits). This will just give you an integer count of the number of features you've requested (as opposed to returning all the features, as a GetFeature request ...


3

You should use a following way: var legendPanel = new GeoExt.LegendPanel({ ... map: map, defaults: { showTitle: false, baseParams: { FORMAT: 'image/png' } } });


3

Thanks to Aragon, i've made it this way: var measure_ctrl = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, { persist : true, immediate : true, handlerOptions : { layer : vecLayer } }); measure_ctrl.events.on({ "measure" : handleFinalMeasurements, "measurepartial" : ...


3

IanT, there is some experimental versioning code around in unsupported land, have a look at WFS-V (WFS versioning) and geogit


3

This is somewhat of a trick question. In terms of GIS functionality, both GeoExt and OpenLayers are very good, approximately equally well-suited to whatever your application is. This is because GeoExt is based on OpenLayers. The real question you should be asking is whether you're already working in an environment with a powerful Javascript DOM-...


3

Solved! ..by using refresh Strategy: 1.Intitalize: var refreshStrategy = new OpenLayers.Strategy.Refresh(); 2.Apply strategy to WFS-Layer: var POIs = new OpenLayers.Layer.Vector("Schneeampel", { strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy, refreshStrategy], projection: WGS84, // empty style ...


3

A 500 error indicates that the server is having problems. This tells me that the proxy is not configured properly. To solve the issue, I would check the following: Are you on a Linux/Unix Machine? The path #!/usr/bin/env python.exe -u; is usually for linux systems. My proxy file on a windows machine has the following as the first line: #!C:/Python27/...


3

What about providing the users with an intelligent search bar (that auto-suggests answers)? This can be easily populated with layer names by making an AJAX GET layer names request to GeoServer at page load. You could then include a few defaults and this 'intelligent' load list.


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