Tag Info

Hot answers tagged

64

Commercial APIs (Google,Bing, Yahoo) Using any commercial API leaves you at the mercy of whatever changes the provider makes to the API or Terms of Service. What happens for example if suddenly your local government portal that uses Google Maps suddenly has adverts popping up all over it? Want to reuse your JavaScript Google Maps code for an Intranet site? ...


23

Go OpenLayers. I had a Google Maps / arcgis api project and about a year ago, i decided to try openlayers. The more i worked with it the more i saw how awesome it is. So i decided to migrate. I cut down 30 - 100 lines of google code into 1 - 3 lines over and over again throughout my code. Simply because openlayers had funtions for what i wanted to do and was ...


21

I would suggest downloading and installing QGIS. You can then open the file that you link to and export the data in variety of formats. The most common format for spatial data of this type is a shapefile which is one of the files that you linked to (TM_WORLD_BORDERS_SIMPL-0.2.zip). The reason that it is a zipfile is that there are several associated files ...


19

Answer to 1st question is Yes. You're using OL with a pretty much common configuration. There are tricks you can use to improve performance, I'll get to that later. Answer to question 2 is maybe (especially with regards to fastness). You can search this site for a list of alternatives (one that springs to mind right now is Leaflet). Answer to question 3: ...


17

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


15

In order to use scales on your map: Set only the 'scales' option. Do not set maxResolution, minResolution, maxScale, minScale, numZoomLevels, or any other scale related property. Set it to an array of scale denominators (or scales). Configure a unit: note that for meters, this should be 'm', for degrees, 'degrees', etc. You can set a maxExtent. Do not set ...


13

You could look at the OpenLayers API, particularly the Geometry classes. You can check for intersects, and have access to vertices etc. I've implemented point buffers in the past just with OpenLayers. Unions may be trickier though. For more complex operations you may want to do the processing server-side, and pass results back in WKT or GeoJSON, both of ...


13

One more time, you should also include Mapquery to your list (based on top of jQuery). Vmx clone seems to be particularly active. By the way, I would provide again Laurent Jegou's benchmark (PDF, french). It is a global outlook on web mapping solutions (both client and server). Regarding your need, it can be a good start to exclude some of them. edit June ...


12

I work on the JS API team and honestly, we could do a better job of documenting this. That being said, we support the browsers supported by the version of dojo we're using. The lastest versions of ArcGIS JS API (2.3 and 2.4) use dojo 1.6.1. The dojo 1.6 release notes list the supported browsers: http://docs.dojocampus.org/releasenotes/1.6 The only caveat ...


11

I'm pretty much done with my port of JTS which is a pure JS port and it's available at https://github.com/bjornharrtell/jsts At the current version (0.9.1) it supports the core functionality of JTS by which I mean predicates and overlays.


11

OpenLayers is the best IMHO. You can easily make WFS calls to an WFS service. If you want to just return data and not map features, you can also do this. Or map features without the data, or both. here are some examples: http://openlayers.org/dev/examples/getfeature-wfs.html http://openlayers.org/dev/examples/wfs-filter.html


11

Rasters are images, so the best format will be an image format (png/jpg/etc). Geojson is a good format for vectors. You will never see, say, your facebook profile pic be transported back as pure json. Of course, returning a url to an image as json is very very different :) As far as the jpeg vs png vs any other image format discussion, there are tons of ...


11

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


10

You need to add a few changes to get the required results: Add the sphericalMercator: true property to your Google layer so vector layers are shown correctly on top of your Google base layer (this is the reason for the shifting geometry). Add in the maxExtent property of your Google layer, otherwise the centre of the map will not be set correctly. The ...


10

For open source mapping solution, you can consider following: Mapping Server Platform - GeoServer Java based and open source. Works well in many production environments: Check : http://geoserver.org/display/GEOS/Welcome User manuals: http://docs.geoserver.org/stable/en/user/ Other option would be MapServer : http://mapserver.org/ Check the ...


10

Well, I coded something yesterday and released it under MIT License. The library, named geostats is available on github. The package includes examples. You will also be able to see it in action on http://www.empreinte-urbaine.eu/mapping/geostats/ (with a concrete choropleth representation sample). It supports the 8 methods listed above : Quantile Equal ...


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


10

Yes. You are looking for the Geolocation API, here's a simple demo. Here is sample code from Dive Into HTML5 and HTML Rocks. Works great from web pages hosted on iOS and Android phones, it's a simple API to use. Strictly speaking it's not GPS; it's a generic location API. On mobile devices like iPhones location is often provided by WiFi or cell tower fixes ...


9

I'm not competent to do a full comparison, but I've done three different small projects with Polymaps and can comment on that. Its main strength is it makes it very easy to composite raster and vector data from many different sources. It can meet all your requirements, particularly in letting you easily add your own colouring, grouping, and interaction. ...


9

You can use register event loadend on your layer. More on: http://dev.openlayers.org/docs/files/OpenLayers/Events-js.html#OpenLayers.Events.on You should call this that: newLay.events.on({"loadend":loadEndListener}); I make it a long time ago, but probably that should work. On another site I found that should be tilesloaded listener, but I don't check ...


9

The trick of using the "myData" parameter should be unnessesarry, as we see in the OpenLayers.Layer.HTTPRequest (which the WMS layer inherits from): redraw: function(force) { if (force) { return this.mergeNewParams({"_olSalt": Math.random()}); } else { return OpenLayers.Layer.prototype.redraw.apply(this, []); } }, if you do ...


8

Yes. Below is the default editor sample tweaked to use the Popup. Create a Popup, pass it to the map's constructor and then place the Popup's dom node as a child of the map. <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" ...


8

Unless you explicitly specify LODs and a spatial reference in your map constructor, they're defined by the first layer added to the map. If you add a dynamic map service to your map first, there are no LODs defined. When you add a cached map service, the cached map service's LODs have to match the map's. If the map doesn't have any LODs, the tiled service ...


8

I don't think regular expressions will help you here, because its designed for pattern matching rather than semantic interpretation, so your string.split() function will probably do as well. But without a database to compare each token against, it'd be pretty hard to determine what level a token represents. If, for instance the right-most token is Zealand, ...


8

you can convert pixels to lat/long with the help of getLonLatFromPixel() function. See also openlayers FAQ.


8

You should use fillColor and strokeColor to style your items. Have a look on the documentation page. You will find below an example based on your code : <script type="text/javascript"> var box_extents = [ [-10, 50, 5, 60], [-75, 41, -71, 44], [-122.6, 37.6, -122.3, 37.9], [10, 10, 20, 20] ...


8

I like @celenius' answer; however, another option would be to export the the World Borders Dataset to CSV using ogr2ogr. I just downloaded your preferred dataset and ran this command with ogr2ogr --note that your script should be a single string without any line breaks. I find them easiest to write in notepad with wordwrap turned on, then I copy them into my ...


8

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


8

They are functionally equivalent. The difference is that require() loads modules using AMD while your second example uses a class from a global variable populated by Dojo's module loader in legacy mode. Technically, you should have to use dojo.require("esri.geomtry.Point") for your second example to work but because the module that defines that class is ...


7

OpenLayers can be used for many static maps; I have in the past created up to 200 maps on a single page without a huge performance penalty, so long as they are simple maps. Many sites have used small, static OpenLayers maps to create simple maps, because then they can use the same set of image tiles that they use for many other maps on their sites. When ...



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