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

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

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


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

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

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

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


1

You can easily recreate the functionality with ol.interaction.DragBox. The interaction has a boxend event, which propagates an object with a getGeometry() function. The geometry can be added to a new feature, which can be added to the vector source. The geometry can be logged directly from the boxend event handler, but the source object also has an ...


1

I suppose you are running Qgis 2.8.1. The openlayers plugin has nothing to do with the JavaScript library Openlayers 2 or 3 ! Anyway to access this plugin in Qgis, you should go the tab 'Internet' and it shoud be there !


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

It appears you did not put the two CSS files (which defines the style) into your code, and they are required when browser tries to render the map. Everything works fine after I added these two CSS files into your code (line 6 and 7). <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>OpenLayers Basic OSM ...


1

You can use geometry.intersects(): function select() { var intersecting_feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-71.104939, 42.418935).transform( new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:3857"))); //vlayer.addFeatures([intersecting_feature]); var features = vlayer.features; ...


1

Assuming that your theta function is being called, the issue that I see is that you are instantiating a new handler, which you don't need. The following theta function should work: function theta() { var x = new OpenLayers.Layer.Vector ("one"); var p = new OpenLayers.Control.DrawFeature (x, OpenLayers.Handler.Polygon); map.addLayer(x); ...


1

One thing you can do if you have base layers with different resolutions is to detect for the layer in the changebaselayer callback and then reset the map's resolutions array, and redraw the panzoombar control, so it can only zoom to the new base layer's resolutions. map.events.register("changebaselayer", this, function (obj) { if (obj.layer.name == ...


1

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


1

So no matter what I tried and the different projections I used, the map would still appear stretched out. I did, however, find a little hacky solution using the tile server at http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile. This works out very well. By translating the OSM url parameters, I leveraged the OSM layer API ...


1

you can get to that information right on the rest endpoint. http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer



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