Tag Info

New answers tagged

0

here a few leads : make sure Geoserver doesn't reproject all the layers everytime a query is made Have a look at the GeoWebCache for more info the docs should help you : superdocs


0

This is only available in OpenLayers master version, not a release as yet, but there is a new config option on ol.interaction.Draw called maxPoints see: http://openlayers.org/en/master/apidoc/ol.interaction.Draw.html The relevant pull request which brought in this new functionality is: https://github.com/openlayers/ol3/pull/3673


0

There is a good example in the ol docs : http://openlayers.org/en/v3.5.0/examples/draw-features.html Look at the source code !


0

Solved my issue by the following code: map.zoomToMaxExtent(); map.setCenter(new OpenLayers.LonLat(28.1231635,40.357895).transform(wgs84,googleMercator), 5); Since I gave the coordinates to wgs84, i needed to transform them to googleMercator.


0

If you indent your code better you could find the errors easier. Your correct code would be: var map; var lon =9.10; var lat =45.46; var zoom =10; function init(){ epsg4326 = new OpenLayers.Projection("EPSG:4326"); map = new OpenLayers.Map("map", { displayProjection:epsg4326, controls: [ new ...


1

OL3 does not support polygon intersection natively, but you can use the turf.js library, which seems to be rapidly growing in popularity and functionality. Under the hood all geometries in turf.js are just GeoJSON, which, naturally, is supported natively in Javascript, making interop with OpenLayers, Leaflet, etc, very easy. var pt = turf.point([0,0]); var ...


1

The logic here would be to first buffer the line upto the given width, and do a simple intersection query. Both these operations require some topology and geometry operations, and can be done either in something like a Spatial Database e.g. PostGis, out even in an amazing JavaScript library called Turf.js


0

Thank you g07kore for your reply , Actually, I integrated in my main page <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script> Then in GeoExplorer.js, the createLayout function is : createLayout:function(){ this.map=new OpenLayers.Map({ theme:null, allOverlays:false,controls:[ ...


0

Google would be new OpenLayers.Layer.Google("Google Satellite", {'type' : google.maps.MapTypeId.HYBRID}); But honestly i would change the codes a bit. I recommend to declare your Basemaps outside of the GeoExt elements. Something like var googleBaseMap = new OpenLayers.Layer.Google("Google Satellite", {'type' : google.maps.MapTypeId.HYBRID}); and ...


1

i faced somehow the same problem. For me that worked. instead of EPSG:4326 in my project i used EPSG:28993. mapOptions = {projection:"EPSG:900913",displayProjection: new OpenLayers.Projection("EPSG:4326")}; map = new OpenLayers.Map(mapOptions); googleBaseMap = new OpenLayers.Layer.Google("Google Satellite", {'type' : google.maps.MapTypeId.HYBRID}); ...


0

The solution is to add this parameter: https://router.project-osrm.org/viaroute?z=18& Then, it will return so many points as the zoom (18 in this example) :)


2

For OpenLayers 2 try map.getCenter() http://dev.openlayers.org/releases/OpenLayers-2.13.1/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.getCenter Or OpenLayers 3 use map.getView().getCenter() http://openlayers.org/en/v3.5.0/apidoc/ol.Map.html#getView http://openlayers.org/en/v3.5.0/apidoc/ol.View.html#getCenter


0

For OSM and similar maps, the map.projection has to be projection: new OpenLayers.Projection("EPSG:900913"), or EPSG:3857 if you prefer. Just changing the code number to 4326 does not reproject the tiles automatically, but places them into a wrong part of the world. Since Opnelayers can not perform the reprojection on its own, you have to follow the ...


0

Thank you so much for replying, I edited it into this : this.mapPanel=new GeoExt.MapPanel({ layout:"anchor",border:true,region:"center", map:this.map, center:mapConfig.center&&new OpenLayers.LonLat(mapConfig.center[0],mapConfig.center[1]), zoom:mapConfig.zoom, items:[{ ...


1

Rather than leaping direct to WPS you might find you can get what you need out of the GeoServer SQL View feature. http://boundlessgeo.com/2015/03/support-story-getting-sql-views/ http://docs.geoserver.org/stable/en/user/data/database/sqlview.html It allows you to write some arbitrary SQL and bind some query parameters into it, so the query becomes a ...


0

Just this new OpenLayers.Layer.OSM("OpenLayers"); It is defined as a baseLayer by default.


0

Thank you all for your help. Actually I'm using OL2 and GeExt, GeoExplorer functions I think the problem is that I defined in the " GeoExplorer.js "a Basemap Layer that is not compatible with my layer. new OpenLayers.Layer.WMS("Global Imagery (OpenGeo) [Online]", "http://maps.opengeo.org/geowebcache/service/wms", { ...


0

You cannot have WFS for Grouped Layers. Grouped Layers are an Geoserver specific service, which works as a Single WMS service containing multiple Layers. This is outside the scope of OGC standards, and it only returns images. Having a vector group layer for multiple layers does not make sense. You should be able to access the individual layers as WFS.


0

Some fairly obvious things to check: 1) try replacing "localhost" with your IP address, especially if you are running your webmap off of another machine (e.g. Geoserver on guest, webmap on host); 2) verify read/write permissions for the folder containing the dataset; 3) Check the code of the openlayers preview and compare to your code. Likewise, note ...


1

I did a similar thing, converting 2D polygons to 3D buildings. I did it in OL3-Cesium though, without any tool, by coding only. I had the coordinates for the polygon, and the height attribute for the building present. (Used a default value in case height was not provided). What I did was adding the 2D polygon as it is to the map. In addition to that, I ...


2

This probably isn't the type of answer that you are looking for, but I'll try to give a general answer on how one could do this. If we break down your problem into smaller tasks, then the first thing that you need to do, is to get the point that the user clicks on. There is an sample on the OpenLayers site that shows exactly how to get this done. Click ...


1

Openlayers is just a JavaScript library, so you can use whichever Integrated Development Environment (IDE) you feel most comfortable using for web development. If you are using a Java web framework then NetBeans IDE would be an ideal choice as its primarily for developing in Java. Its also worth checking out the JetBrains IDE's. Edited to answer your ...


0

Well, I should have done this in the first place... I looked at the source code. Here is an abbreviated look. The LayerSwitcher is an OpenLayers Class, and it has a method called redraw(). In this method see the final if statement I've included. It disables the checkbox if the layer is not in range. So if I want it to do something different, I need to ...


0

@Brian B Please share the part of code where you are setting the layer visibility to True/False to help analyze the issue better


0

I found out why its not working: ExportMap was never officially released in OpenLayers after camptocamp made the ExportMap changes.


0

It's working for me with a textfield (id: 'TextField') in the tbar and with the code: var test= Ext.getCmp('TextField'); test.setRawValue();


0

You could for example use jquery Datatables ( www.datatables.net ) and create the data-structure on the server-side with php: https://www.datatables.net/examples/server_side/ Then load this data dynamically in your datatable. If you have a common key you could even synchronize the select-control of openlayers with the datatable. You can have a look at ...


0

You can access the number of features in the cluster strategy object. If there were no more strategies added to the layer, the correct path to the array is the following: mylayer.strategies[1].features


0

There aren't any methods to bind feature requests to a button click. You should bind the whole layer construction to the button, if you wouldn't like to request the features on initialization. You should also check if the layer has been initialized in order to avoid memory leaks. var mylayer; button.onclick = function() { if (!(mylayer instanceof ...


0

Thomas' answer works perfectly but I checked that it is not necesary to create a new function and define fromProjection and toProjection as global variables introducing directly the following code inside the script just at the end. map.events.register("moveend", map, function(){ $("#Bounds2").text(" -> "+map.getExtent()); ...


2

You could register the zoomend- and moveend-Event for your map like this: function bounds_update() { $("#Bounds1").text(" -> " + map.size); $("#Bounds2").text(" -> " + map.getExtent()); $("#Bounds3").text(" -> " + map.getExtent().transform(toProjection, fromProjection)); $("#Bounds4").text(" -> " ...


1

There's no easy mapping from a 3D globe to a 2D zoom level. On a round globe, different tiles are at different distances from the 3D camera: Some tiles are draped over the horizon, or viewed at steep angles. The camera may be down low near a point on the ground, but looking out towards the horizon, so it can see high-level tiles in the foreground and ...


0

There is an outstanding pull request which should give you a good idea on how to achieve this: https://github.com/openlayers/ol3/pull/3241/files


3

Polygon layers by default do not stay the same size when zooming further out because they represent an area. The only aspect that you will see for smaller polygons when zoomed out is just the outline. If you still want to represent the feature when zoomed far out one option would be to add a <PointSymbolizer> within the sld that will turn on at x ...


0

I guess you are using GeoExt as you are talking about a "LayerTree", right? If yes, just use a OverLay-Layer-Container: http://geoext.org/lib/GeoExt/widgets/tree/OverlayLayerContainer.html var layerList = [ { nodeType: "gx_overlaylayercontainer", text: "Overlay Layers", expanded: true }]; var tree = new Ext.tree.TreePanel({ title: "Layer", loader: new ...


0

If you want to set the height of the map-div to 100% you should use percentage for the parent Elements, too: Just try to add this to your style-section: html, body { height: 100%; } More info: http://webdesign.about.com/od/csstutorials/f/set-css-height-100-percent.htm Edit1: Just tested your javascript with my own WMS-Service and it works fine. ...



Top 50 recent answers are included