Tag Info

New answers tagged

2

The problem with the above code was that map.getLayersByName("Annotations") returns a list and not a single object. So the drawn features were actually being added to the layer but my accessing of the layer was incorrect. Correct getFeatures() code: function getFeatures() { var annotation_layer_list = map.getLayersByName("Annotations") var ...


0

triggerEvent wants an event as second argument and that event apparently needs an "xy" property with the coordinates like that: event.xy = {x: 0, y: 0} Fixes the error message but unfortunately still does not trigger the popup for me.


2

I do this by using MultPolygon, as you've mentioned above. The trick I've used is that after drawing a polygon (when your FeatureAdded function is called) it should add a polygon to a JavaScript object that mirrors the structure of a MultiPolygon. Here's a quick pointer on doing that type of wrapping/unwrapping: ...


0

In addition, you can use GeoServer for some functions like intersection, clipping, buffering etc... In GeoServer Demos, you can test those functions and see what would be the result of it. After you find proper function, you can use that XML code to put it in Javascript and make some further actions.


0

You could listen to the postrender event which is triggered after a frame is rendered. map.on('postrender', function(){ console.log('frame rendered'); });


1

Simplest way I've found is to set the interaction defaults to false when you instantiate your map like so: var map = new ol.Map({ interactions: ol.interaction.defaults({mouseWheelZoom:false}), ... }); Then once it is disabled you will need to provide your own functions to zoom on mouse scroll. Something like this should do the trick: ...


0

I fixed problem by filling polygons with some color. Note: I'm running GeoServer 2.5.2 and bug is not fixed. But link above is very usefull, it helped me. Thanks to user30184.


1

I haven't tried the combination of Geoserver and Oracle but I guess that the WFS-T should work out of the box like it does when I use PostGIS as Database. First of all I think you should find out WHY your features are not stored (violated NOT NULL constraints, check-constraints or something like that). In your Geoserver WebUI you can doublecheck that in the ...


2

Perhaps you are running GeoServer 2.5 and you have faced a bug that happened if there was no fill defined for polygons. Bug was resolved in GeoServer 2.5.2. Read more details from http://osgeo-org.1560.x6.nabble.com/WMS-GetFeatureInfo-with-Polygon-td5163455.html. First aid would be to add fill to the polygon style. Updating GeoServer should be a definitive ...


1

As part of the WPS-GUI project that I did I created a WPS client "library" that closely models after the OpenLayers 2 interface. It uses JSONIX (http://confluence.highsource.org/display/JSNX/Jsonix) for the all OGC XML marshalling and unmarshmaling. You can check it out here: https://github.com/boundlessgeo/wps-gui/blob/master/src/wpsclient.js


0

The OpenLayers.Bounds class has a range of contains* methods, you can use containsLonLat in your case: var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286) .transform( new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject() ); var bounds = new OpenLayers.Bounds(5, 42, 10, 45); var isInside = bounds.containsLonLat(lonLat);


0

You can have a look at the intersection example of OpenLayers: http://dev.openlayers.org/examples/intersects.html for(var i=0; i<features.length-1; ++i) { feat1 = features[i]; for(var j=i+1; j<features.length; ++j) { feat2 = features[j]; intersects12 = feat1.geometry.intersects(feat2.geometry); if(intersects12) ...


0

You should see if using ESRI's satellite imagery or Mapbox's satellite imagery will work for what you need. If not, I know DigitalGlobe will sell you imagery, but I'm not sure how much it costs.


0

I found the issue! It was because the workspace was in uppercase in GeoServer. I convert to lowercase when I set the parameter in the protocol object and now it works. I don't know the reason, may be this is a bug?


1

For the labels use Overpass Turbo to query the Openstreetmap data for what information you want. If you are new to this service or want a different way to do the same thing use the Quick OSM plugin to do the same (it in turn uses Overpass). If you have some familiarity with OSM then this should be a relatively simple process - at least if you are looking ...


0

I haven't found out yet why exactly this does not work. but if you are interested in a "quick and dirty" workaround until you have found the error you could use this: map.setCenter(new OpenLayers.LonLat(-91, 25).transform('EPSG:4326', 'EPSG:3857'),4); map.panTo(new OpenLayers.LonLat(-90, 25).transform('EPSG:4326', 'EPSG:3857')); ...


0

Ok, it turns out that OpenLayers 2.x can't see the proj4.js I'd downloaded (from here) ... So, I downloaded pro4js.js v1.1.0 (note the extra 'js') from here: http://trac.osgeo.org/proj4js/wiki/Download Then I did this after including the lib: Proj4js.defs["EPSG:3009"] = "+proj=tmerc +lat_0=0 +lon_0=15 +k=1 +x_0=150000 +y_0=0 +ellps=GRS80 ...


0

I am not totally sure if I understand what you want to do. But when calling writeFeatures on a format, you can specify the dataProjection (the projection you want to have in your output format) and the featureProjection (the projection of your features that you want to export). See ol.format.GeoJSON.writeFeatures. So for example if your features are in ...


0

Currently there is no way to get a reference to a source from a feature. You can implement a piece of code that checks if a given source contains a feature.


2

You can't use the OL2 way variable substitution, using the ${} notation. In OL3 there is the "style function" concept you can pass to the layer style property. It is executed for each feature and receives as argument the feature to be rendered and the resolution at which it is rendered. With all this you can get feature properties and use to return an ...


0

Just remembered about the styling options. I can set the default fillOpacity to 0 in the styleMap


0

this.strategies.filter.setFilter(); should work I use a WFS-Layer for filtering: var filterStrategy = new OpenLayers.Strategy.Filter(); var layer = new OpenLayers.Layer.Vector("WFS", { strategies: [filterStrategy] }); To reset the filter I just use filterStrategy.setFilter(); and this works well. You could of course also set a filter ...


2

I haven't tested this but I think you can define two filters and set a parent filter with the OR-Operator: var filter_zero = new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.EQUAL_TO, property: attribute, value: 0 }); var filter_null = new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.IS_NULL, ...


0

In OpenLayers the map holds that information so a call to map.getScale() will return the current scale denominator of the map. If no baselayer is set, returns null. All you need to do is put "1:" in front of it.


0

By chance, I have stumbled upon the answer - it is to call changed() on the features themselves after changing the style property of their associated data. See: http://openlayers.org/en/v3.2.0/apidoc/ol.Feature.html?unstable=true#changed This does require me to keep track of the ol.Feature objects associated with each vectorData object (formerly, I only ...


2

When you define your vector source, put the projection setting pointing to the target coordinate reference system (see the docs): new ol.layer.Vector({ title: 'added Layer', source: new ol.source.GeoJSON({ projection : 'EPSG:3857', url: 'mygeojson.json' }) }) Look at this example (using your sample data): ...


2

I have put a projection setting in your source definition and it seems to work: var vS=new ol.source.GeoJSON( ({ "object": data, projection: 'EPSG:3857' }) ); This is the result: http://jsfiddle.net/zzahmbff/3/ Perhaps this resource can help you to see different ways to load vector data: ...


4

You probably do both, but mostly on OpenLayers. The GeoServer part is mostly related to styling of layers. OpenLayers is the client, and GeoServer is the server. For basic cases, you load the data into GeoServer (and publish out whatever layers and styling you need), then use OpenLayers in your web page (javascript and HTML). OpenLayers calls GeoServer to ...


6

Geoserver is OWS server. That is a server side application that can serve maps using standards like WMS and WFS. Being a bit more precisely WMS serve images that represent maps or layers, WFS serve features, WPS process data using predefined operations, ... Geoserver includes a web admin interface where you can style the layers or preview it. The layer ...


1

You could define two or more rules. Either static in your sld style or dynamic with mergeNewParams: theSLD_BODY= '<?xml version="1.0" encoding="utf-8"?>' + '<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" ...


0

It doesn't work with geoJSON like that, it took me a day to figure this out, you need to make sure that: Your geoJSON only containts Points, not LineStrings etc. even if it holds 1 the cluster layer will not display without js errors. make sure you transform where needed concerning projections. If you load geoJSON from a file in contrast to the example ...


1

I would try those steps: Update the mapfile with a generic request for the layer ( i.e. DATA "geodata from geo_data"); Add EPSG:3857 in the METADATA (i.e. "wms_srs" "EPSG:4326 EPSG:3857"); this is the default SRS used by OL3. Test the WMS service in a Desktop application and request the layer in EPSG:3857.


1

Something seems to be wrong with your coordinates or the assigned EPSG-Code. EPSG 31466 is the "Gauß Krüger Zone 2"-CRS. The first number of the x-Values is the number of the (Gauß-Krüger-)zone, which means that your x-values would have to beginn with a 2. The central median is at 2.500.000,000 plus/minus 3 degrees. Your x-value should also have 7 ...


2

It's EPSG 4326. llbox means latlon-boundingbox. Every layer has to be published in 4326 but can often be requested in different crs's, so you get the llbbox always in 4326. just reproject them with .transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:31466")); for example var my_extent=new ...


0

You can get the current extent with: var extent = map.getView().calculateExtent(map.getSize()); Then you can use ol.proj.transformExtent to reproject the extent.


0

Actually I'm not sure if the SaveStrategy of OpenLayers can catch these notices. In the OGC specification is written: Individual exception messages are contained within the <ExceptionText> element. The mandatory code attribute may be used to associate an exception code with the accompanying message. The optional locator attribute may be used to ...


0

Delete comment in httpd.conf line: mod_proxy.so and mod_proxy_http.so This modules operate proxy. And of course restart Apache.


1

Just try poly.geometry.getCentroid() instead of poly.getCentroid() The "getCentroid()"-method is part of the feature geometry, not of the feature itself: http://dev.openlayers.org/docs/files/OpenLayers/Geometry-js.html#OpenLayers.Geometry


0

You need to add the control OpenLayers.Control.Navigation() to the OpenLayers.Map object. Please check this: http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Control-js.html Hope it helps if you haven´t found the solution already.


0

There are 2 kinds of solution based on my experience: js problem: copy your code in jetty web app beside your GeoServer for solving js security problem GeoServer problem: after solving problem in 1, if does not work, your Layers in GeoServer is not complete. for example if one of your Layers does not have 'Style' your code does not work


0

An incomplete and partial answer I'm afraid - but it may point you in a helpful direction: I've had multiple problems trying to print with a background based on the Openlayers plugin. The solution for me was to find a service which allowed me to download glued-together and georeferenced tiles from the web mapping I needed. For me this service is 'Bigmap' ...


1

There a two or three possible reasons that come to my mind: Option1: your Webserver is not configured properly: What happens for example if you try to access this site(presuming that you put your proxy.cgi in your usr/lib/cgi-bin -folder): http://yourserver_ip_or_adress/cgi-bin/proxy.cgi?url=http://www.openstreetmap.org If you wont see the ...


0

I agree with John Barça that a bit more of your javascript code would be useful or the information which errors you get in your console. What I can see so far is that you have some typos: use OpenLayers instad of Openlayers in your var custom_button and control_panel and you forgot on semicolon after control_panel.addControls([ ...


0

Even if the question was asked a bit ago here is one solution: Have a look at the status page of your Geoserver-GUI and see which Geotools version your geoserver uses: Then download the gt-mongodb-jar of the version xx from http://download.osgeo.org/webdav/geotools/org/geotools/gt-mongodb --> in my case version 11 ...


2

WGS 84/ UTM 48N. My coordinates are in decimal degrees is a contradiction. If they are in decimal degrees, you must set the layer CRS to EPSG:4326, not any UTM system which has meters as units. From that point, use Rightclick, Save As ... to another filename and EPSG:3857 as CRS. With the project CRS set to EPSG:3857 and Oepnlayers background tiles, the ...


0

as user underdark already mentioned there are also versions of the pgrouting workshop online that used OpenLayers 2.x You could for example download a slightly newer version of the workshop at https://github.com/pgRouting/workshop/releases/tag/v0.6.1 which uses OpenLayers 2.10 Here you can see a part of the demo-app: function pgrouting(store, layer, ...


1

Create the vector layer: var vector = new ol.layer.Vector({ source: new ol.source.KML({ projection: 'EPSG:3857', url: 'http://path/to/your/data.kml' }) }); Add it to the OpenLayer 3 map: var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vector ], ...


0

I'm guessing you mean the extent of the View at any zoom or center. Btw I have all my layers in 4326 so no convertion need it. I use this to avoid pan the map outside an area. If you know map.size (that is html div size) and resolution (that depend on zoom) you can know how big is your Extent. Then using your center you can calculate all corners. var ...


1

It looks like you are retrieving the extent of the projection, and not the current map. You could try getExtent: map.getExtent(); This returns a bounds object that can be transformed to give lat lon.


0

You may use the setMousePointerSwitcher() function, see example code in link below: function setMousePointerSwitcher() { var panelControls = map.getControlsBy('div', $('basic-controls'))[0].controls; for (var i = 0; i < panelControls.length; i = i + 1) { var c = panelControls[i]; ...



Top 50 recent answers are included