maps

Using PHP (curl) to pull data from JSON (Google Maps API)

荒凉一梦 提交于 2019-11-29 21:34:16
I'm fairly new to JSON, and I'm trying to get the latitude and longitude of a geocoded city from the Google Maps API using curl. The function I'm using is: function geocode($city){ $cityclean = str_replace (" ", "+", $city); $details_url = "http://maps.googleapis.com/maps/api/geocode/json?address=" . $cityclean . "&sensor=false"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $details_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $geoloc = json_decode(curl_exec($ch), true); $step1 = $geoloc['results']; $step2 = $step1['geometry']; $coords = $step2['location']; print $coords['lat'];

How can I merge two STL maps?

拈花ヽ惹草 提交于 2019-11-29 21:12:41
How can I merge two STL maps into one? They both have the same key and value types ( map<string, string> ). If there is an overlap of the keys, I would like to give preference to one of the maps. jkerian Assuming you want to preserve the elements in mapA , and merge elements in mapB for which there is no key in mapA : mapA.insert(mapB.begin(), mapB.end()) will do what you want, I think. Working example: #include <iostream> #include <map> void printIt(std::map<int,int> m) { for(std::map<int,int>::iterator it=m.begin();it!=m.end();++it) std::cout << it->first<<":"<<it->second<<" "; std::cout <<

Google Maps API Countries and Regions as Polygons

人走茶凉 提交于 2019-11-29 21:03:08
问题 I've got a question about highlighting areas on Google map. I know how to place polygons on map. It's pretty simple and straghtforward. The problem is I don't have access to such data and I don't know any source of it. From my database I get lat/lon for a specific place and I need to have data about their borders. Do you know any free or paid database that contains such polygons data for all countries/regions in the world? Thanks in advance. 回答1: http://www.gelib.com/world-borders.htm There

在信息系统中根据坐标,调用并展示GOOGLE地图!!

可紊 提交于 2019-11-29 20:31:43
最近在做信息系统,需要根据坐标在地图上展示,做点记录,哈哈, 这东西看起来不错,有点不好的是IE6居然不支持/ 首先在ASPX页面中的HEAD中加入以下标记 View Code <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script> 增加以下JS代码 View Code <script type="text/javascript"> ///经纬度换成十进制数 var DegreeToDecimalDegree = function (sJWZB) { var aDSM = sJWZB.split("."); var

Displaying and navigating large custom maps offline using Phonegap

可紊 提交于 2019-11-29 19:40:39
问题 My question is how to efficiently display large custom maps in an offline Phonegap application, allowing them to be panned and zoomed smoothly while still supporting older mobile devices? I’m developing a mobile application that involves using geolocation to navigate walking routes in remote areas where it’s likely the user won’t have a signal and therefore an internet connection. It’s important that the app works well with Android 2.2+ (so SVG is not an option) as well as iOS4+. I’ve drawn

Multiple “InfoWindow” for array of “markers” on Google Maps?

久未见 提交于 2019-11-29 18:51:46
Using Google Maps API to add an infoWindow to each marker. Markers come from an array. Although, infoWindow only shows up for the first marker, not the others. Why? Thanks. function set_markers(array) { var mapOptions = { zoom: 13 } for (var i = 0; i < array.length; i++) { var single_location = array[i]; var myLatLng = new google.maps.LatLng(single_location[1], single_location[2]); var marker = new google.maps.Marker({ position: myLatLng, map: map, title: single_location[0] }); var infowindow = new google.maps.InfoWindow({ content: "" }); } google.maps.event.addListener(marker, 'click',

Uncaught InvalidValueError: not a Feature or FeatureCollection

非 Y 不嫁゛ 提交于 2019-11-29 18:44:02
问题 After seeing a recent video by the Google Devs I decided to do a regional map of the UK. There were a couple of possibilities mentioned on this site that I've since had to dismiss* So I ended up using this site (example page of data downloads): http://mapit.mysociety.org/area/11804.html Notice the GeoJSON download as the third link down? Its about a 1Mb file size. When I first tried using it with my map: function initMap(){ var ukc = new google.maps.LatLng(54.8, -4.6); var mapOptions = { zoom

Drawing a Circle with a Radius of a Defined Distance in a Map

巧了我就是萌 提交于 2019-11-29 16:14:29
I am able to plot a map and caption a specific point: library(maps) map("state") text(-80.83,35.19,"Charlotte",cex=.6) I can also plot a circle centered around that point: symbols(-80.83,35.19,circles=2, add=TRUE) However, I would like to control the size of the circle. In particular, I want to draw a circle with a radius of 100 mile around multiple locations contained in a data.frame, matrix, or list. You can write a function to customize how you want the circle to look. For example: plotCircle <- function(x, y, r) { angles <- seq(0,2*pi,length.out=360) lines(r*cos(angles)+x,r*sin(angles)+y)

How do I change the NA color from gray to white in a ggplot choropleth map?

前提是你 提交于 2019-11-29 16:07:59
问题 I am trying to create a choropleth map of the US that has the default color changed from gray to white. I have records for 18 of 48 states and the code works to color by value, but for those states where I have no records the states are gray. I would like them to be white. How do I change the color? library(maps) library(plyr) library(ggplot2) records1<-read.csv('E:/My Documents/records_by_state.csv') records<-data.frame(state=tolower(rownames(records1)), records1) head(records) all_states<

Android maps - Markers Bounds at the center of top half of map area

前提是你 提交于 2019-11-29 15:53:14
I have Android Map Extension attached under actionBar. I have couple of markers, lets say 2000. Than I have ArrayList of selected 3 markers upon some constant condition, nevermind. I want to zoom and move map to include this selected 3 markers at max possible zoom. It's an easy task, from this forum I found an easy way to do it : LatLngBounds bounds = new LatLngBounds.Builder().include(new LatLng(maxLat, maxLon)).include(new LatLng(minLat, minLon)).build(); mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); I have map perfectly zoomed at this 3 markers. Now is hard part. When I