Jsantos | 26 Aug 18:58 2015
Picon

Obtaining Layer name when clicking on the map

Hello all,

I have 4 layers in the map and need to determine the layer that I clicked
in. I have the following code inside  map.on('singleclick', function (evt) ,
but feature is always undefined.

var displayFeatureInfo = function(pixel ) {
  var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
    return feature;
    });

My layers are like this one:

var wmsSourceWatermains = new ol.source.TileWMS({
    url: 'http://192.168.1.113:8080/geoserver/wms',
    params: { 'LAYERS': 'watermains' },
    serverType: 'geoserver'

});

I create the layers with :

var layers = [

    new ol.layer.Tile({
      source: new ol.source.OSM()
    }),

    new ol.layer.Tile({
     source: wmsSourcePzones
(Continue reading)

Dominik Abrahám | 25 Aug 11:17 2015
Picon

GeoServer WPS process fail with OpenLayers 2: “The request body should be contained in a CDATA section”

Hi,

I am trying to create an application with WPS builder like this: http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/wps.html
When input format = "text/xml; subtype=wfs-collection/1.0", it creates input field for name of the layer on my server:

function addWFSCollectionInput(input) {
    var name = input.identifier;
    var field = document.createElement("input");
    field.title = input["abstract"];
    field.value = name + " (layer on the server)";
    addValueHandlers(field, function() {
        input.reference = field.value ? {
            mimeType: "text/xml; subtype=wfs-collection/1.0",
            method: "POST",
            body: {
                wfs: {
                    version: "1.0.0",
                    outputFormat: "GML2",
                    featureType: field.value
                }
            }
        } : undefined;
    });
    document.getElementById("input").appendChild(field);
}

This input is required for example by algorithms gs:Clip and gs:Aggregate. When I'm trying to run some of these algorithms, it returns this kind of result:

<?xml version="1.0" encoding="UTF-8"?><wps:ExecuteResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" service="WPS" serviceInstance="http://46.28.111.137:8080/geoserver2711/ows?" version="1.0.0"><wps:Process wps:processVersion="1.0.0"><ows:Identifier>gs:Clip</ows:Identifier><ows:Title>Clip</ows:Title><ows:Abstract>Clips (crops) features to a given geometry</ows:Abstract></wps:Process><wps:Status creationTime="2015-08-25T08:35:59.568Z"><wps:ProcessFailed><ows:ExceptionReport version="1.1.0"><ows:Exception exceptionCode="NoApplicableCode"><ows:ExceptionText>The request body should be contained in a CDATA section, otherwise it will get parsed as XML instead of being preserved as is</ows:ExceptionText></ows:Exception></ows:ExceptionReport></wps:ProcessFailed></wps:Status></wps:ExecuteResponse>

How can I fix it?

Thanks
_______________________________________________
Users mailing list
Users@...
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Ronan2575 | 12 Aug 14:21 2015
Picon

Align map under vector layer and make vector lines transparent

I am displaying an Indoor map, originally drawn on AutoCad, then put through
QGIS to make the KLM file, the KML file is used in the system for the
co-ordinates of the map. 

I want to have the original map (drawn in Autocad) to be the map on display,
instead of seeing the red outlines (vector lines). 

I want the image aligned with the vector map, and the red line (vector
lines) made transparent, 
The reason we need to do this is the vector map lines, are to solid, no
doors, windows, room names not visible etc.  

How can I do this? 

Any help greatly appreciated .

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Align-map-under-vector-layer-and-make-vector-lines-transparent-tp5219522.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Wolfgang Wienke | 7 Aug 19:55 2015
Picon
Picon

Text is moving over the map

Hi,
please help a dummy!
Why ist the text moving over the map when zooming?

<div id="map" class="map"></div>
<div style="display:none"><p id="text" >Hallo Welt</p></div>

<script>
var layer    =  new ol.layer.Tile({
	title: 'Luftbild',
	type: 'base',
	source: new ol.source.BingMaps({
			key: apiKey,
			imagerySet: "Aerial"
                        }),
        });

var map = new ol.Map({
  		layers: [layer],
  		target: 'map',
  		view: new ol.View({
			center: [0, 0],
			zoom: 2})
		});

var Welt = new ol.Overlay({
  		positioning: 'center-center',
	  	position:
	ol.proj.transform([6.0362,50.8134],'EPSG:4326', 'EPSG:3857'),
  		element: document.getElementById('text')
		});
map.addOverlay(Welt);
</script>
--

-- 
                               mit freundlichen Grüssen

                                     Wolfgang Wienke
Wolfgang Wienke | 15 Jul 21:04 2015
Picon
Picon

text over of a map

Hi,
I hope anybody will help a dummy to solve the problem. I want to place
two texts at different positions over a map.
I took an API-example and tried to simplify it for my task. The above
script works, but it places BOTH texts at BOTH positions.
Which is the misunderstanding? Can I find everywhere more explanations
than in the API-docs and exmaples?
Which is the easiest solution for the following script?

<!DOCTYPE html>
<html>
<head>
<title>Clustering example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.7.0/ol.css"
type="text/css">
<script
src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.7.0/ol.js"></script>
</head>
<body>
    <div id="map" class="map"></div>

<script>
var features = new Array(2);
features[0] = new ol.Feature(new ol.geom.Point([4000000, 4000000]));
features[1] = new ol.Feature(new ol.geom.Point([6000000, 2000000]));

var styles = new Array();
styles[0] = new ol.style.Style({
	text: new ol.style.Text({
		text: 'hello world!',
		fill: new ol.style.Fill({
			color: '#fff'
		})
	})
});

styles[1] = new ol.style.Style({
	text: new ol.style.Text({
		text: 'hello new world!',
		fill: new ol.style.Fill({
			color: '#fff'
		})
	})
});

var clusters = new ol.layer.Vector({
		source: new ol.source.Vector({
			features: features,
			}),
 		style: styles,
});

var raster = new ol.layer.Tile({
		  source: new ol.source.MapQuest({
			layer: 'sat'
		})
});

var map = new ol.Map({
  layers: [raster, clusters],
  target: 'map',
  view: new ol.View({ center: [0, 0], zoom: 2 })
});

</script>
</body>
</html>
--

-- 
joaorodr84 | 14 Jul 20:54 2015
Picon

setOpacity does not work on google layers

I am working on a GIS API that uses OpenLayers 2.13.

I also use the google layers: OpenLayers.Layer.Google.

The opacity options does not work with google layers.

I define my map and layers like this:

    map = new OpenLayers.Map('map', {
        allOverlays: false,
        autoUpdateSize: true,
        displayProjection: new OpenLayers.Projection('EPSG:4326'),
        numZoomLevels: 16,
        projection: new OpenLayers.Projection('EPSG:900913'),
        zoomMethod: null,
        units: 'km'
    });

    map.addControl(new OpenLayers.Control.LayerSwitcher());

    var osm = new OpenLayers.Layer.OSM();

    var google = new OpenLayers.Layer.Google('google', {
        map: map
    });

    map.addLayer(google);
    map.addLayer(osm);

    var center = new OpenLayers.LonLat(-0.125, 51.5);
    center.transform(new OpenLayers.Projection('EPSG:4326'), new
OpenLayers.Projection('EPSG:900913'));
    var zoomLevel = 4;
    map.setCenter(center, zoomLevel);

The setOpacity method works fine with the OSM layer:

    osm.setOpacity(0.5);

But when I do:

    google.setOpacity(0.5);

it does not work.

I have created a  CodePen <http://codepen.io/joaorodr84/pen/PqaEww>   to
easily show the problem I am facing.

Apparently, it is a common issue, because  I have read about
it
<http://gis.stackexchange.com/questions/69637/google-base-layer-opacity-change-in-openlayers-2-13> 
, but I have not found any solutions yet.

How can I make the setOpacity method work for google layers?

Thanks a lot.

João Rodrigues

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/setOpacity-does-not-work-on-google-layers-tp5215612.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
stoner | 9 Jul 22:49 2015
Picon

ol3 and react js / flux?

I'm looking at creating an application using react js[1] and writing an open
layers 3 react component.  Obviously they can live side-by-side, but I was
wondering about the handling vector data, and the various flux[2] or flux
like [3] workflows.

I've found a couple leaflet examples, working with data, but no open layers
examples.  So as I'll rather not find this out the hard way my question is: 

Is there anything inherent differences between leaflet and openlayers that
means leaflet is a better match for react? 

Thanks, 

Michael Stoner

[1] http://facebook.github.io/react/ 
[2] http://facebook.github.io/flux/
[3]
http://www.christianalfoni.com/articles/2015_04_26_Handling-complex-state-with-Baobab

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/ol3-and-react-js-flux-tp5215124.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
stoner | 9 Jul 22:46 2015
Picon

ol3 and react js / flux?

I'm looking at creating an application using react js[1] and writing an open
layers 3 react component.  Obviously they can live side-by-side, but I was
wondering about the handling vector data, and the various flux[2] or flux
like [3] workflows.

I've found a couple leaflet examples, working with data, but no open layers
examples.  So as I'll rather not find this out the hard way my question is: 

Is there anything inherent differences between leaflet and openlayers that
means leaflet is a better match for react? 

Thanks, 

Michael Stoner

[1] http://facebook.github.io/react/ 
[2] http://facebook.github.io/flux/
[3]
http://www.christianalfoni.com/articles/2015_04_26_Handling-complex-state-with-Baobab

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/ol3-and-react-js-flux-tp5215123.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
michael6779 | 9 Jul 13:48 2015

Update the_geom field only

Hi,

Is there anyway to have only the_geom field updated when you save the
feature?

At the moment I'm using Geoserver with Openlayer 2.13 and I have a table
with a bit field in it.  Currently Geoserver doesn't support writing to
bitfields but it supports reading from it.

What I want to do is update the geometry field of a feature but not alter
other attributes.  Is this possible?

I tried deleting the attribute like this

delete feature.attributes[attributeName]

or setting the attribute to null like this 

feature.attributes[attributeName] = null

But it doesn't work and still fail to save.  

I know that the bit field is preventing the feature from saving as I have
verified that it works by removing that field in database and saving.

Michael

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Update-the-geom-field-only-tp5215041.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
toni hernández | 9 Jul 09:05 2015

Reprojecting on the fly a GML layer from WFS

Hi there,

I am working with Openlayers 3.6 and I am trying to display a gml layer from a WFS service. And not only that, I am also trying to reproject this layer from epsg:4326 to epsg:3857. This part of the code looks like:

    vectorSource.addFeatures(gmlFormat.readFeatures(data, {dataProjection:'EPSG:4326', featureProjection:'EPSG:3857'}));

The entire example is here

http://sigserver4.udg.edu/apps/ol3/wfs_usa_states.html

After loading the page, no error is thrown but the gml layer is not displayed.

After executing this (in the javascript console)

vectorSource.getFeatures()[5].getGeometry().getCoordinates()

I get something like

[[[[4641827.511692658, NaN, 0], [4626910.811245848, NaN, 0], [4607302.996137521, NaN, 0], more...

So, Is there a problem reprojecting "minus" coordinates formated like "-xxx.xxxx"?

The same example works fine if I add the outputformat=JSON to the WFS call, but I would like to use GML if possible for didactic purposes (I am developing a course about OpenLayers). Also, the example works fine if I do not reproject features, and change the srsnam param to srsname=EPSG:3857.

Any ideas?
Thank you all.

--
Toni Hernández Vallès
Servei de Sistemes d'Informació Geogràfica i Teledetecció
-
Universitat de Girona
SIGTE
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni-5gccqtd/IEERA9EQCv0AEA@public.gmane.org

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG

_______________________________________________
Users mailing list
Users@...
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Phil Scadden | 7 Jul 06:21 2015
Picon

Geoserver GWC layers plotting offset at some zoom levels.

I have GWC tile caching turned on for a layer in geoserver 2.7.1.1 
(direct integration turned on), then at some zoom levels, it plots 
displaced from where it should be. Turn GWC off for the layer, refresh 
browser, and it plots okay. This when calling as WMS layer from 
Openlayer 2.13-1 master. I remember this being an issue back in 2012 and 
issue https://github.com/openlayers/openlayers/issues/688 is still open. 
I am not doing any pre-seeding. Problem only occurs at some zoom levels.
A request looks like:

http://myserver/wms?LAYERS=mylayer&TILED=true&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG:3857&BBOX=18628621.034844,-6521221.593125,18785164.06875,-6364678.5592188&WIDTH=256&HEIGHT=256

Note the EPSG:3857 - the tileset in GWC is 900913 but I am guessing the 
equivalence is handled.

Is this still the maxextent playing badly?

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

Gmane