Tag Info

Hot answers tagged

13

Every feature has a style property which is null by default because it inherits the parent vector layer's style. But you can set the style for each feature: DEMO DEMO LINK Code Example: var myFirstLineStyle = OpenLayers.Util.applyDefaults(myFirstLineStyle, OpenLayers.Feature.Vector.style['default']); myFirstLineStyle.strokeColor = "#ffffff"; ...


10

This demo takes in two coordinates and a color and will create a Geodesic line between them. DEMO LINK You can add lines by entering information into the form, OR programmatically like so: //Taj Mahal to Venice (San Marco) AddLineProgrammatically(new OpenLayers.LonLat(78.0447, 27.17461), new OpenLayers.LonLat(12.34014, 45.43338), "#006633"); //Roman ...


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

If you use custom objects and properties in your GeoJSON, they are ignored when the object is read using GeoJSON format. You can clearly see this on line 115 of the GeoJSON.js source code. Since the properties are never read in the first place, it is not possible to get them in OpenLayers. There are multiple workarounds to get what you want. You could ...


3

Service parameter is mandatory for making requests to WMS services. Your URL should looks like: http://localhost:8080/geoserver/wms/filedata?request=GetCapabilities&service=WMS


3

You need to write a custom control that does that thing. Ive written a tutorial on the topic, so check it out :) http://codentonic.net/2015/04/02/custom-openlayer-control/ if you have any questions feel free to ask me


3

you dont need to define any srs to your ArcGIS93Rest layer if your map projection and service projection is identical. var options = { projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326"), units: "m", }; the below code working is working as it should work. ...


3

Your code is working fine for me, once I do the following two: Use the full OpenLayers.js file. Use a properly configured proxy. Have you done this on your side? My Code is as follows: <script type="text/javascript"> var map; function init() { var bounds = new OpenLayers.Bounds( 145.19754, -43.423512, ...


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


2

I am not aware of this tool, and cannot find much mention of it outside the whitepaper you linked to. I think it is a proprietary toolbar, which may or may not be available for commercial use. This type of operation is often performed using FME, which has been improved in recent years to allow the creation of 3D buildings with different shapes, styles and ...


2

The easy way I use to set up styling is to load your dataset in QGIS and style it with that. Use only simple style features like colour and width and do it on a single attribute. The save that QGIS style as SLD, and copy paste that XML into GeoServer's style dialog. Trouble shoot that a bit to make sure it all came through, and you're good to go! You do ...


2

At the moment I still prefer OpenLayers2. You can find a nice tutorial here: http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html or even have a look at the "official" openlayers-example: http://dev.openlayers.org/releases/OpenLayers-2.13/examples/wfs-protocol-transactions.html ...


2

You could try to use the move callback: var my_polygonhandler = OpenLayers.Handler.RegularPolygon; var polygonControl = new OpenLayers.Control.DrawFeature(circles, my_polygonhandler, { handlerOptions: { sides: 40 } }); polygonControl.handler.callbacks.move = function (e) { var linearRing = new ...


2

So you want to create a heavy and dated looking panel based map interface? /joking/ Personally I would use Leaflet and JQuery. Both are very lightweight but have a wide range of mature plugins that can deliver what you need in a lightweight and modular way. I don't think Bootstrap will be of much benefit. Map frames are pretty much responsive by default ...


2

From the API docs (http://openlayers.org/en/v3.4.0/apidoc/ol.Map.html?unstable=true#forEachFeatureAtPixel): To stop detection, callback functions can return a truthy value. map.forEachFeatureAtPixel(pixel, function(feature) { el.innerHTML += feature.get('Proj_Client') + '<br>'; return true; });


2

You could use St_Envelope on all your airports docs ! ST_Envelope — Returns a geometry representing the bounding box of the supplied geometry.


2

Just use ST_Extent for the sub-query that selects your airports. The only trick is that in PostgreSQL you must use an alias for the subquery. Look at "a" in the following example which gives the aggregated extent of the 5 first geometries of the table. select ST_AsText(ST_Extent(a.geom)) from (select geom from tableName limit 5) as a;


2

No, you don't need separate vector files for each zoom level. Of course they could speed things a little bit up but will also require much more storage space than using a single database for a specific area. However do note that PBF files are not suited for on-demand rendering. They are designed for efficiently storing OSM data, not for running queries on ...


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


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


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


1

According to the api ol.Map.html#forEachFeatureAtPixel If you put a return statement that should return only one object. In your case: var firstFeatureFound = map.forEachFeatureAtPixel(pixel, function(feature) { return feature; }); el.innerHTML += firstFeatureFound.get('Proj_Client') + '<br>';


1

I use Bootstrap (and you can try the excellent BootLeaf template) to build a webpage with a nearly full-screen map. I've also used Bootstrap to build a single-page app with a smallish map. You can also use simply Leaflet, and set up some buttons about the place using the built in controls, or roll your own user interface. To answer your actual question, ...


1

To squeeze out every little bit of your code, you should get rid of the main bottleneck, plus lower the redundancy, like here. The code can run under 200ms, which is very good compared to the original 500ms runtime. The main bottleneck is in the createCircle function. If you don't need every point to be present in a separate layer, you should pull the layer ...


1

Just use the OpenLayers.Control.GetFeature: var your_control = new OpenLayers.Control.GetFeature({ protocol: OpenLayers.Protocol.WFS.fromWMSLayer(your_wms_layer), box: true, hover: true, multipleKey: "shiftKey", toggleKey: "ctrlKey" }); ...


1

This is quite a wide ranging question. It might be worth looking at some of the OpenLayers examples to give you an idea of where to get started. Probably the WFS Transaction Example would be the most useful. Apart from how to handle the client side editing in OpenLayers you also need to think about how you're going to store the data. To do this you'll need ...


1

To be able to edit the data you might want to look at the WFS-T technology. Here is a nice tutorial for OpenLayers with GeoServer and PostGIS. Note that you don't have to use PostGIS if you don't want to, this works also with simply loading some shape files to GeoServer Hope this helps :)


1

I posted this answer on reddit as well, but I think it will be beneficial here too. I've spent a lot of time with Geoserver setting up an application with OpenLayers, and I think I understand what you are looking for, here are my thoughts. For web maps, it is best to use the web map service (wms). This essentially takes your spatial files (.shp, sql ...


1

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


1

Sorry, the Heron print preview is not compatible with the Suite SDK.



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