55

You can get polygon coordenates in json for using with googlemaps using openstreetmap. Go to http://nominatim.openstreetmap.org/ search a place like "Partido de Ituzaingó" click on "details" Look for OSM ID and copy it (control+c), example: 2018776 paste the ID in http://polygons.openstreetmap.fr/index.py and download the polygon


24

To get polygon boundaries just add format=json to your request! So instead of https://nominatim.openstreetmap.org/search.php?q=Warsaw+Poland&polygon_geojson=1 use https://nominatim.openstreetmap.org/search.php?q=Warsaw+Poland&polygon_geojson=1&format=json By adding &format=geojson you can get a valid geojson response


23

I can use Google Maps in OpenLayers 4.2 like this under my WMS layer and its perfectly fitted with EPSG:3857 projection: new ol.layer.Tile({source: new ol.source.TileImage({ url: 'http://khm{0-3}.googleapis.com/kh?v=742&hl=pl&&x={x}&y={y}&z={z}' })}) Why do you need a plugin? JSFiddle link for ROADMAP new ol.layer.Tile({ source: new ...


15

Here is some code I'm successfully using to toggle a Fusion Tables layer in one of my maps: google.maps.event.addListener(map, 'zoom_changed', function() { zoomLevel = map.getZoom(); if (zoomLevel >= minFTZoomLevel) { FTlayer.setMap(map); } else { FTlayer.setMap(null); } }); it looks almost identical to your code, apart ...


10

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


10

According to links provided by Andre Joost, I found the translation. And this is the projection for google.maps: function MProjection() { } MProjection.prototype.fromLatLngToPoint = function(latlng) { var x = (latlng.lng() + 180) / 360 * 256; var y = ((1 - Math.log(Math.tan(latlng.lat() * Math.PI / 180) + 1 / Math.cos(latlng.lat() * Math.PI / 180)) /...


9

I have put together a simple function for you: function markerCoords(markerobject){ google.maps.event.addListener(markerobject, 'dragend', function(evt){ infoWindow.setOptions({ content: '<p>Marker dropped: Current Lat: ' + evt.latLng.lat().toFixed(3) + ' Current Lng: ' + evt.latLng.lng().toFixed(3) + '</p>' }); ...


9

Drag Marker and Geocoder with Coordinates https://gmaps-samples-v3.googlecode.com/svn-history/r49/trunk/draggable-markers/draggable-markers.html Entire code: <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">&...


9

I think this is not so hard a problem to solve but I have my doubts about whether the accuracy is absolutely correct. First of all, you have to convert your center lat/lon to pixels with gdal2tiles codes. If I find some time and if you want, I can convert it to stable code for finding corner coordinates. This is a Python code: tileSize = 256 ...


8

Firstly you need to make sure that your WKT string is properly formatted. After that you can use a custom function to parse the string, and draw a polygon. I could use the following code: var wkt="POLYGON(...)"; //this is your WKT string //using regex, we will get the indivudal Rings var regex = /\(([^()]+)\)/g; var Rings = []; var results; while( ...


8

1) There's a bit of code you can add to your spreadsheet and run a macro. The instructions are detailed here: https://vilimpoc.org/blog/2013/07/11/google-spreadsheet-geocoding-macro/ with the code also available at https://github.com/nuket/google-sheets-geocoding-macro 2) CartoDB can pull in a google doc spreadsheet directly from your account, then you can ...


8

Yes, you can use custom tiles with Android Maps API v2 - you can see a fully working example in our OpenTripPlanner for Android app on Github. (You can also download the app directly from Google Play) We support the following tile providers: LyrkOpenStreetMap MapQuestOpenStreetMap Mapnik CycleMap Google (normal, satellite, hybrid, terrain) Our ...


7

There are two approaches. One is brute-force: write code to find the distance between a point and a polygon, and then iterate over all polygons. The second involves building efficient data structures, an arduous process. For the first approach, you might look at this Wolfram Demonstration Project for computing the distance from a point to a polygon. Link ...


7

It really depends on your users requirements. I recently started a project in the Google Maps API, where I overlaid some services from ArcGIS Server and had some basic queries going on. I wanted to use Google, so that I could legally incorporate their Streetview/Geocoding/Traffic APIs into my map. As this would be a public facing application, I also ...


7

No, there is no way to steal Google's data. May be you could look at OpenStreetMap which is designed for people to download.


7

I've found a work around solution for this problem. Go to www.gadm.org/country Choose your country and select Google Earth .kmz file format Choose the level you need (level 3 is the deepest with all small towns/cities) Download the file (can be large) Unzip the .kmz file (You'll find a .kml which is XML) Open it with Sublime or notepad++ (the file will ...


7

It's possible to us ol.source.Tile to access to every google maps. For everybody needs it, this is the basic code to create every available google maps layer to add to a map developed in Openlayers 4: var googleLayerRoadNames=new ol.layer.Tile({ title: "Google Road Names", source: new ol.source.TileImage({ url: 'http://mt1.google.com/vt/lyrs=h&x=...


6

There is the Route360 API that also works with Google Maps. https://developers.route360.net/index.html It offers quiet a few functionalities. Including different modes of transportation or the intersection of polygons As well you can add a few hundred points at once and see the result: It works for most countries in Europe and North America


6

I think you will find numerous answers to similar questions on our site by searching the geocode tag. A few that stick out are: Geocoding API Comparison Bulk Geocode 20 million records What reliable GeoCoding service would you recommend me? Is there an open source Geocoding tool which can be used commercially? Geocoding that's anonymous, good, and free - ...


6

The following piece of code allows you to transform your latitude and longitude coordinates from epsg:3857 to epsg:4326 in just one line. Just substitute longitude and latitudine values to LON and LAT in the code. point = new OpenLayers.LonLat(LON,LAT).transform('EPSG:4326', 'EPSG:3857'); In point you'll have an OpenLayers readable point.


6

Google Static map api requires centre,lat/lng and pixel size as well as zoom level This is a non-JavaScript version (but python) for working out the pixel dimensions. You will need to modify to suit your needs but the key point is that it contains CalculateBoundsZoomLevel Which take a cluster of points and calculate the zoom level and centre of the map ...


6

Get the x,y coordinates of the boundaries of countries from the following website Natural Earth (thanks, Devdatta Tengshe) which has more accurate data than others I've tried. Then use ArcGIS 10.2 to open the map shape file and select the boundaries you need. Go to data management tools --features-- features vertices to points and open the generated table. ...


6

The file sizes you are using are far too big to be using GeoJSON rendered as vectors on the client-side. It will be slow to download and also bog down the browser as it struggles to render all of the geometry. The best practice for medium to large size datasets is to render them as images on the server and send those images to the client. I build a lot of ...


6

I suggest you to use this opensource library: GMap.NET - Great Maps for Windows Forms & Presentation GMap.NET is great and Powerful, Free, cross platform, open source .NET control. Enable use routing, geocoding, directions and maps from Coogle, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yendux, Mapy.cz, Maps.lt, iKarte.lv, NearMap, ...


6

In the following lines you are trying to refer to a DOM element that does not exist: document.getElementById("lat").innerHTML = location.lat(); document.getElementById("lon").innerHTML = location.lng(); So in your HTML you would have to add an element like a div or a span, that you can give an id. I would use a span, so you can stay in the same line ...


6

The answer to this question is somewhat technical. First you need to recall that the Earth looks like this: So when it's drawn as a flat surface, there will be distortion. How much distortion depends on the projection. The Web Mercator map projection is famous (or, in some circles, notorious) for the infinite exaggeration at the poles (note that Greenland ...


5

Disclaimer: I work for iGeolise You can use the TravelTime API to draw maps based on drive times here, it works for location-based searches (for consumer-facing sites for example) or one off maps. This example is for drive times from Norwich, UK. There are multiple polygons for 15 minute intervals from 15 mins - 1 hour, starting at midday. It uses lat/ ...


5

i dont know how do you define your proj4js defination in EPSG27700.js but you have to define it in openlayers as following: Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs"; then you can transform it by this way: var ll = new OpenLayers....


5

Openstreetmap uses the same tile naming as Google Maps. You find a lot of formulas to calculate them here: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames


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