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.


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.


3

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


2

If you look at the source for getGeodesicArea, which is actually in the LinearRing class, you will will see from the comments (and the code) that this calculates an approximate area based on a sphere. If you look at GeographicLib, which includes a Javascript port of the C++ library, you will see that they use ellipsoidal calculations, which will be more ...


2

The geodesic area for your example is 19518154994956.3 m² (using GeographicLib). E.g.: var points = [ {lat: 0, lon: 50}, {lat: -5, lon: -60}, {lat: -30, lon: -30} ]; var p = GeographicLib.PolygonArea; var result = p.Area(GeographicLib.Geodesic.WGS84, points, false); var area = result.area; // 19518154994956.285 Here are multiple ...


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

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

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

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

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

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

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


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

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.


1

What I found out: It works, when I create a new base layer and set the parameter layer_gesamt.isBaseLayer = false.


1

I don't even think being able to extract the T and V, if possible, is gonna be reliable cross-browsers. Might just be a browser interpretation thing. In any case, if you have access to it, I would just add your own attribute when you're creating the layer: var foo_layer = new ol.layer.Vector(...); foo_layer.layer_type = 'vector'; Then you can use it later ...


1

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


1

The vertices function might help you, as documented in the GeoServer manual. I used this to show cadastral survey points.



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