Tag Info

Hot answers tagged

7

Why use a database? Because it's not necessarily the case, especially with larger datasets, that you can expect to be able to push the entire thing to the client. If you're talking thousands of points, then sure, but for millions of points you probably don't want each and every one represented in RAM on your end users' client. Not everyone has a super fast ...


4

This is not possible with WMS. WFS gives the data itself (READ only), and WFS-T is a transactional extension of WFS that allows you to CREATE/UPDATE/DELETE data through the WFS protocol. In your case, for what you need, you can't use WMS / GetFeatureInfo but you need WFS-T or to use a different approach like JDBC to edit the content of your postgis tables.


4

For example: let's say you have a 10 megabyte raster/vector file that covers a large area. If you include the file directly into OpenLayers, it will download the entire file to the browser and render whatever part of it the map needs even if it's a small area. What mapserver will do for you is always deliver to the browser a small image of exactly what ...


4

If you have to work with a Google base map, OpenLayers 2 will satisfy your needs. As stated in an OpenLayers 3 issue by @ahocevar, There will be no ol.source.GoogleMaps, unless Google change their policy and allow direct access to their map tiles. Your only chance to use Google wiht OpenLayers 3 is to make a base map without any controls with Google ...


3

I use Leaflet with SVGs as the maps. I do this because I want the map functionality on top of a floor plan. In my experience, it works much better than Raphael.js (maybe just because it's newer?), which my company used for the same purpose on a previous project. I have also made map tiles out of floor plans, but the SVGs are faster and smoother when zooming ...


3

You need to use WFS-T, the T standing for transactional, which is what's required to be able to write-back. Both Openlayers and GeoServer support this. This question may help on the script side - WFS-T: changes not saved on an OpenLayers map There's also a sample tutorial here: ...


3

Google maps is not a WMS service, and the terms of use of Google Maps itself prevent legal usage of it in a server side application, unless of course you have some sort of commercial contract with Google that entitles you to use their tiles outside of a browser.


2

You will need to add a new interaction. Assuming that... this.mapRaster = ol.Map This should work this.mapRaster.on('singleclick',function(e){ var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(e.coordinate), }); iconFeature.setStyle(_self.iconStyle); _self.rasterVectorSource.addFeatures([iconFeature]); Make the ...


2

I got the solution. If you want, just do the following... //Styles to switch off the roads var stylez = [{ "featureType" : "road", "stylers" : [{ "visibility" : "off" } ] } ]; //Satellite var ghyb = new OpenLayers.Layer.Google( "Google Hybrid", { ...


2

I think the best approach is to go with Mapserver or Geosever (since you are new, Geoserver will look a lot easier) Once you set a WMS service with geoserver, you can add the resulting WMS to your OpenLayers project. Geoserver automatically returns only the information in the extent of the current view, also you can set the range of visible scales on your ...


2

http://jsfiddle.net/a6pp9vwz/9/ working for me. Console log said "$ not defined". $ is a jQuery class, so you need a jQuery environment to enable AJAX requests. You can enable jQuery in JSFiddle in the "Frameworks & Extensions" tab.


2

Lets assume you want to save a feature from a OpenLayers Vector Layer into PostGis and that you want to achieve this using GeoServer. The general steps would be as follows: You need to configure a WFS in geoserver using PostGis as a data store (GeoServer publish posgis table) You need to configure your vectyor layer to point to the wfs you just created ...


2

You can use the write function of the OpenLayers.Format.GeoJSON to generate (Geo)JSON directly. The input is either an OpenLayers geometry, feature or feature vector, so the returned JSON, will either contain one or many features depending on the input. Note if your OpenLayers Features have attributes, these get turned into JSON too, so you can use this to ...


2

This example should do what you want: http://openlayers.org/en/master/examples/mouse-position.html It's an OpenLayers Control ( http://dev.openlayers.org/docs/files/OpenLayers/Control/MousePosition-js.html) , but you can get it to point at specific objects on the screen so it gets written there instead. var mousePositionControl = new ...


2

That is a very hard question to answer. OpenLayers 2 has been very successful and it is easy to find examples for just about everything. OpenLayers 3 is a total rewrite and uses the Google Closure toolkit which provides a number of useful services: code compression, event handling, cross browser support, etc. OpenLayers 3 also uses webGL rendering, when it ...


2

I didn't play with it but I remember seeing Bjørn Sandvik from Thematic Mapping playing with Three.js and WMS. The recipe is available on this blog post.


1

If security is not an issue but you only want to load data within the current viewport. You can also look at OpenLayers BBOX strategy.


1

Your problem may come from using WFS 1.1.0 with a coordinate system that has a northing-easting axis order. You can try these solutions: Use WFS 1.0.0 version. You can test that 1.1.0 sends coordinates as northing-easting ...


1

OpenLayers has a GetCentroid function for getting the centre of a polygon if you don't want to bring it in from the database directly: http://dev.openlayers.org/apidocs/files/OpenLayers/Geometry-js.html#OpenLayers.Geometry.getCentroid From there you should just be able to treat the point as a regular point feature. See also this example: ...


1

You need to get the data from the server in geoJSON format. I can get you an example in PHP if you want, but I think there are plenty examples around. Then in Javascript, you can do something like this: $(document).ready(function(){ setInterval(function() { $.get("datasource.php", function (data) { if ( !data.error ) { ...


1

This can simply be done by defining extent in the View object. eg var view = new ol.View({ ... extent: [minx,miny,maxx,maxy] ... }); var map = new ol.Map({ ... view: view, ... });


1

If I understand your question, you want to be able to change a property on all or some of the features (on separate layers) on the map. From the ol.map object, you can get the layergroup property. This will give you access to all the layers on the map, you can then just do something like: var layers = map.get('layergroup').getLayersArray(); for (var i in ...


1

What are looking for is an OpenLayers strategy. You do not use this directly, but one of the subclasses, such as BBOX or Cluster or Fixed. The cluster strategy does as it says and combines point that are close together into clusters, based on a threshold, which will lead to much faster rendering times when you have many points in view. Unfortunately, the ...


1

thanks my friend Chris, he's truly help me resolved the problem... and the anser will be like this.. http://jsfiddle.net/v18kuxgf/ polygonLayer.events.register('featureadded', null, function(event) { var feature = event.feature, geometry = feature.geometry; if (geometry.getArea() ...


1

I got it : I just deleted onPopupClose from popup definition in function monpopup(event). Now white cross does its job


1

You can set the base layer by doing: var layers = this.map.getLayers(); layers.insertAt(0, base_layer);


1

After loading all the datas in vector layer we have to redraw vector layer. map.getLayersByName(vectorlayerName)[0].redraw(); Thank you @iant. :)


1

Check your Geoserver Layer Setup. Open the WMS layer and go to the Publishing Tab .. There is a check box under WMS Settings labeled Opaque, make sure that this is unchecked.


1

Check your coordinates in these layers. Maybe they don't match on each other and you are switching from one system to another with layer switching... I am not sure what are your WMS made of. Is that blue line a vector? If it is raster it can cover all other layers (it has no transparency) with white border we see around line (maybe it has defined boundaries ...


1

Check out this function, provided by Openlayers: getFormmatedLonLat function, in the Openlayers.Utils object. An use example: var ns = OpenLayers.Util.getFormattedLonLat(point.lat, 'lat', 'dms'); var ew = OpenLayers.Util.getFormattedLonLat(point.lon, 'lon', 'dms'); The output must be a string like: Xº Y' Z'' for each coordinate.



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