Tag Info

Hot answers tagged

20

I have used both OpenLayers and Leaflet in my apps. There has been so much discussion on this topic in this forum and others on planet-internet. They usually fall into 2 camps - features and flexibility of OpenLayers versus simplicity of Leaflet. I would not be surprised if someone spawns an "OpenLeaf" initiative soon marrying the best of both worlds! I ...


15

If you want a clusterer like redfin then check out my Leaflet.markercluster: http://danzel.github.com/Leaflet.markercluster/example/marker-clustering-realworld.388.html https://github.com/danzel/Leaflet.markercluster It is fully animated etc etc :)


9

Firstly, it is possible to add your own data on top of Google Maps, using Google Maps API. For example, this and this page show two different ways of adding a WMS service on to of Google Maps. You can easily add vectors as overlays. OpenLayers has many advantages as compared to Google Maps API, including: It is completely Open Source and standard ...


8

I'm not sure why you are excluding services like Google Maps, especially since your expected traffic not that high (Google starts charging after 25,000 map views (your map views will be much lower than 10,000): https://developers.google.com/maps/faq#usage_pricing). What you basically need is two things: Someone to provide you with the Web slippy map. This ...


8

The WMSGetFeatureInfo doesn't work by requesting info on the feature being currently clicked as such. It works by formulating a WMS GetFeatureInfo request which passes a BBOX string to the WMS server. So, when you click on the map the location coordinates are captured and then sent to a WMS server as the request. You could see this in action by using ...


8

This questions has been asked a number of times. 30k points, straight up, will not work on an OL map. Or even on a Flash/Silverlight map. Rough (rough!) order of magnitude numbers to remember - 100 points on a JS map (openlayers), 1,000 points in a Flash Map (e.g ArcGIS Flash or Silverlight), 10,000 points on a desktop app (ArcGIS Desktop) are your fine ...


8

Unfortunately you cannot connect a web page directly to a database because of security concerns, normally you need some middleware to join the two together. So for your example and if you want to stick with Open Source software you could easily use GeoServer as your geographic server to serve your data from your PostGIS database to your OpenLayers HTML web ...


8

What you want to do, is usually called a 'Swipe' tool. There is no inbuilt tool or control for this in OpenLayers, but thankfully, there is an example here: Swipe Control with Google and OSM based on a custom class. You just need to include this JavaScript file in your application. Most Swipe Tools/controls that I have seen online, are based on the ...


8

Mango does it with Leaflet. Check out an example here. Of course you could just save the time to code it yourself and just create the map for free using Mango.


7

you can do with the same method: map.events.register(type, obj, listener); movestart triggered after the start of a drag, pan, or zoom move triggered after each drag, pan, or zoom moveend triggered after a drag, pan, or zoom completes zoomend triggered after a zoom completes example code: map.events.register("move", map, function() { ...


7

You need a proxy if you are making an AJAX request to a machine and/or port that is different from the one that your webpage was served from. So in both your examples above you will need a proxy (on the server that is serving the webpage) if you want to make WMS getfeatureinfo requests or any sort of WFS request. However you do not need a proxy for simple ...


7

Since I am building something somewhat similar right now, I am going to tell you how I am doing it and you can choose to change whatever you want from it for another piece. Django (with GeoDjango) is pretty good for this as a basic framework for python (again, if that is your thing, you could do this in another language). My approach for user-level edits ...


7

GetFeature control designed for retrieve features from a server and fires events that notify applications of the selected features. In your case you should use SelectFeature control: selectFeature = new OpenLayers.Control.SelectFeature( vectorLayer, { onSelect: clickNotice, autoActivate: true } ); map.addControl(selectFeature); ...


7

The option, displayInLayerSwitcher is True by default. You must pass this parameter explicitly with the False arguement. http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html var ol_wms = new OpenLayers.Layer.WMS("OpenLayers WMS","http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'}, {'displayInLayerSwitcher':false} );


7

You need to call the API to update map size. http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.updateSize Here's how we do it window.onresize = function() { setTimeout( function() { map.updateSize();}, 200); } You can see we did a slight delay, and honestly I don't remember the exact reason why, but we had to give it a slight ...


6

Why dont you use the classic way: var style = { strokeColor: "#00FF00", strokeOpacity: 1, strokeWidth: 3, fillColor: "#00FF00", fillOpacity: 0.8 }; var p1 = new OpenLayers.Geometry.Point(lon, lat); var p2 = new OpenLayers.Geometry.Point(lon, lat); var p3 = new OpenLayers.Geometry.Point(lon, lat); var p4 = new OpenLayers.Geometry.Point(lon, ...


6

according to me it cant dissapear. the feature has changed due to the changes in the natural projection. Naturally, the feature might be located to 0,0. if you want to see your feature: map.zoomToExtent(vectorLayer.getDataExtent()); and still you can get your feature as, vectorLayer.features[0] i hope it helps you...


6

You should use vertexRenderIntent property of ModifyFeature control. For example: var vertexStyle = { strokeColor: "#ff0000", fillColor: "#ff0000", strokeOpacity: 1, strokeWidth: 2, pointRadius: 3, graphicName: "cross" } var styleMap = new OpenLayers.StyleMap({ "default": OpenLayers.Feature.Vector.style['default'], "vertex": ...


6

Go through the following questions. GIS for the web Steps to Start Web Mapping Web GIS Development Skill Sets


6

Change it to look like this var kmllayer = new OpenLayers.Layer.Vector("KML", { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: "./my-kml-file.kml", format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: ...


6

Try to change the name of the layer after adding the layer. Here it works: http://maps.stamen.com/test/openlayers.html write in console: map.addControl(new OpenLayers.Control.LayerSwitcher) then layer.setName('customName')


6

see the Layer Load Monitoring sample for some ideas. layer.events.register("loadend", layer, function() { this.logEvent("Load End. Grid:" + this.grid.length + "x" + this.grid[0].length); });


6

According to this thread at the GeoExt mailing list: Re: [Users] Printing google maps using geoext and geoserver Andreas Hocevar Mon, 23 Jan 2012 04:37:31 -0800 Hi, the GMaps API Terms of Use don't allow you to print. If you only want to print the map background, click on the Google logo in your map to view the same extent in Google Maps, ...


6

Do you need to synchronize only moving and zooming of map? In that case, one simple solution is: listen moveend event on map, and then zoom other map to extent of current map. map1 = new OpenLayers.Map('map1'); map2 = new OpenLayers.Map('map2'); map1.events.on({ moveend: function(evt) { map2.zoomToExtent(map1.getExtent()); } }); ...


6

From the sounds of it you are trying to put down 1500 vector markers onto an OpenLayers map. Am I right? If this is the case then I would strongly suggest using some other method to display your vector features, as 1500 vectors in an OpenLayers map is a lot and will cause the browser to slow down and even crash altogether. The differences between browsers in ...


5

There is the LoadingPanel addin: http://trac.osgeo.org/openlayers/wiki/Addins/LoadingPanel This could easily be altered to show a "waiting cursor" by altering the "minimizeControl" and "maximizeControl", removing the this.div.style.display = "none"; this.div.style.display = "block"; lines and adding: document.body.style.cursor='auto' ...


5

Both of the above answers are right, just want to mention another method. You can use the Polygon.createRegularPolygon() method as well when you know the Center of your square but don't know or don't want to calculate the square bounds. Meaning you're drawing a square around some center point. Now for circle, you'd pass in like 30+ points, and it ...


5

I'm using an stack similar to Ragi's I'm near the alpha version of my application and at this point it seems that the choices where right. Here is my solution: At the server: Ubuntu server + apache web server + apache tomcat. Postgresql + postgis as database. Geoserver, (in my case I use it only for rasters). Django Framework + Tastypie. Tastypie ...


5

Few options. Some crazier :-) than others. The basic strategies are Cluster features Hide/move the top feature Send the click through the top feature ==> Turn on feature clustering strategy Implement your own clustering algorithm, so when a new item is added or modified, your algorithm re-runs and does a nested for-loop check and n*n(-1) checks to ...


5

Use strokeWidth : 1 and strokeColor: '#000000' on the vector's style Actually, after testing what I said, turns out it's not that simple. Looks like lines don't use the fill property at all and instead only use stroke. So the only way I was able to do it was by cloning the feature and modifying the style. So you have 2 features. Here's the DEMO Demo LINK ...



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