# Tag Info

37

All we need to create an interactive Google Map in the notebook is access to the individual tiles - and there is a relatively simple naming scheme for those tiles. I actually typed up a description of this naming scheme a few years ago and posted it here: http://facstaff.unca.edu/mcmcclur/GoogleMaps/Projections/GoogleCoords.html The examples on that page ...

23

In the example code, CountryData[#, "AntarcticNations"] is a built in predicate that returns True or False. You need something similar for your countries. Perhaps, myCountries={ "Germany","Hungary","Mexico","Austria", "Bosnia","Turkey","SouthKorea","China"}; Graphics[{If[MemberQ[myCountries,#],Orange,LightBrown], ...

22

Thanks to Simon Woods' advises it should now be correct. Taking the OP's informations: loc = {46.72, 25.59};(*CityData["Gheorgheni","Coordinates"]*); dist = 4*10^6;(*distance in m*) bounds = Table[GeoDestination[loc, {dist, i}][[1]], {i, 0, 360, 1}]; Graphics[{EdgeForm@Thin, Red, Polygon[Reverse /@ bounds], Opacity@.33, EdgeForm[Thin], ...

17

I separated this project into two parts. The first is to compute the coordinates of the Geohash location. (*Grab the user's geographical location. The location is based on IP address, so it may not be completely accurate. It's usually good enough to get your graticute. You can replace home with with known coordinates in the form {hx, hy} if you like.*) home ...

14

I guess you're hoping to take data produced by Mathematica via commands like CountryData and CityData and display that data on a map of some type. From your question, it's honestly not totally clear if you'd prefer an in notebook solution or a completely separate Google Map but both are possible. A static map in notebook In order to display your points as ...

12

The main problem here is that you need to include a VertexTextureCoordinates (VTC) in the Polygon for a texture to be applied. However, the rest of the problem is not as simple as it seems. Here's the output of my approach. Below it, I discuss texturing several polygons belonging to the same country, according to their timezone. You can also skip that and ...

12

Using the new geographic tools in Mathematica 10: GeoGraphics[ GeoCircle[ GeoPosition[Entity["City", {"Gheorgheni", "Harghita", "Romania"}] ], Quantity[4000, "km"] ], GeoBackground -> "StreetMap", (* To get country labels *) ImageSize -> 800 ] WRI posted another example on Twitter. There is another tool called GeoIdentify that ...

11

Try this: CityData[#, "Coordinates"] & /@ CityData[All] also if you want the city too {#, CityData[#, "Coordinates"]} & /@ CityData[All] I assume that the option "Coordinates" need a specific city so you have to retrieve all the available cities in the database and then feed each one to CityData to get its coordinates.

11

Comment I've placed a Notebook version of this post on my webspace here: http://facstaff.unca.edu/mcmcclur/polylineDecoder.zip The Notebook is actually contained in a ZIP file that also contains all the Java class files necessary to get this code to work. The Notebook sets the Java class relative to it's own directory using ...

11

The problem seems to be related to mixing geopositions and raw long/lat pairs. pos is expressed as a GeoPosition and the polygon is expressed as raw pairs. The graphics are better behaved if all coordinates are expessed in the same fashion. Option one: use geopositions throughout Change the assignment to {a, b, d, c} from this: {a, b, d, c} = ...

10

You could use the official ICAO abbreviation: Entity["Airport", "KLAX"] which makes sense because you will only be able to use officially named airports most of the time anyway. You can always get those (or the city details) via a W|A query and work your way from there (no googling involved): or like this (although it misses Van Nuys):

10

Use Interpreter without federal state or country. Works even for small german towns :) Interpreter["City"]["Memmingen"] GeoPosition[%] GeoGraphics[%] EDIT: Also you could ask for the airport: town = Interpreter["City"]["Memmingen"]; airport = Interpreter["Airport"]["Memmingen"]; GeoPosition[{town, airport}] or just use the nearest airport ...

9

I found some free gis data of indian roads. I extracted the india-latest.shp.zip and then imported the roads.shp file. Here is a quick example to extract relevant roads: (* Make sure to fix the path *) indiaRoadData = Import["india-latest.shp/roads.shp", "Data"]; (* This just happens to be where the Lines are located in the data, see below for some ...

9

Alternate approach: Graphics[{ {Orange, CountryData[#, "SchematicPolygon"] & /@ MyCountries}, {LightBrown, CountryData[#, "SchematicPolygon"] & /@ Complement[CountryData[], MyCountries]} }] which draws all of "your countries" in one color, and then the rest of the world in another.

8

The most likely cause of your problem is that you are swapping lat and long coordinates. Your latlong definition in the .NB file provided goes like this: latlong = {{40.660323, -73.997952}, {40.660489, -73.99822}, {40.654365, -74.004113},... That's New York. Simply plotting without projection gives: m1=Graphics@Point@latlong I seem to see ...

7

You can use the undocumented option OfficialLanguages CountryData["Republic of South Africa", "OfficialLanguages"] {"Afrikaans", "English", "IsiZulu", "IsiXhosa", "Sepedi", "Swati", "Ndebele", "Sesotho", "Xitsonga", "Setswana", "Venda"}

7

You have mixed up latitudes and longitudes. So first of all change ToExpression@{#["lat"], #["lng"] } into ToExpression@{#["lng"], #["lat"] }. The second problem you have is that when you combine graphics with Show all the common options are taken to be that of the first graphics which in your case is the histogram, but what you really want is the aspect ...

7

I'm not quite sure what you mean by distances in "diagonal matrix" form. Pairwise distances are certainly displayed as matrices, but these are not diagonal (they're symmetric, with zeros along the diagonal). In any case, here's a way to obtain that. I'll define a function cityData that returns the great-circle distance between two cities: ...

6

I recently implemented a native Mathematica decoder for the encoded Google polyline strings returned during a request to its API. This uses Compile and I found it faster than the above J/Link based solution. I guess it could have been even faster if we could compile the BitShiftLeft and BitShiftRight. But I guess these two functions are pretty optimized in ...

6

This seems to work: LatitudeLongitude @ GeoGridPosition[{172248, 1002321, 0}, "SPCS83NY04"] (* {49.145, -75.732} *)

5

The problem comes from rasterization by MorphologicalComponents. Maybe you could avoid it at the first place. mapdata = Import["http://gadm.org/data/shp/FRA_adm.zip", "Data"]; regiondata = "Geometry" /. mapdata[[2]]; departdata = "Geometry" /. mapdata[[1]]; regionNum = Length@regiondata t1 = Graphics@{ Rectangle[{-6, 41}, {9.7, 51.5}], ...

5

The approach to address the encircling areas will be using the Graph fucntionality available in Mathematica. There are some null values in the dataset so we'll remove them in the new dataset piracyLocations. asamjson = Import["http://msi.nga.mil/MSI_JWS/ASAM_JSON/getJSON?typename=\ DateRange_AllRefNumbers&fromDate=19900101&toDate=20140801", ...

4

You can also exploit the GeoGraphics in version 10. Using some of your variables (noting there seems to be an issue with plotting more than 4000 points or generating density histogrm with more points...that I do not fully understand): Getting a feel: GeoGraphics[{Red, PointSize[0.005], Point[(Normal@piracyLocations)[[1 ;; 4000]]]}] Now generating ...

4

Here's a quick answer for your first question (I'll let someone else handle the mapping (that's a lot of data to sort through). Let's look at the wonderful (cough) city of Houston. winddata = WeatherData[{"Houston", "Texas"}, "MeanWindSpeed", {{1973, 1, 1}, {2013, 5, 1}, "Day"}]; Gather those values by day: daysorted = GatherBy[winddata, #[[1, {2, ...

4

bg = Import["sample.shp"] Show[bg, Graphics[Point@Reverse[latlong, {2}]]]

4

The problem is using rectangle at the beginning. Use Background -> Black instead: t1 = Graphics[{EdgeForm[Thick], FaceForm[White], ("Geometry" /. mapdata[[2]])}, Background -> Black, ImageSize -> 600]; t2 = Colorize[MorphologicalComponents[t1, CornerNeighbors -> False], ColorFunction -> "LightTerrain"]; t3 = Show[Graphics@{Black, ...

4

So both CountryData["World", "LandArea"] - (CountryData["Antarctica", "LandArea"] + Total[CountryData[#, "LandArea"] & /@ CountryData[]]) and CountryData["World", "LandArea"] - Total[Flatten[CountryData[#, "LandArea"] & /@ CountryData["Continents"]]] give $3.42636\times10^6 \text{ km}^2$ of area missing. That is approximately the area of ...

4

Mathematica 10 introduced new ways to highlight countries on the world map. Examples follow below. There are lots of more examples in the documentation which showcase alternative stylings. myCountries = Map[ Entity["Country", #] &, {"Germany", "Hungary", "Mexico", "Austria", "Turkey", "SouthKorea", "China"} ]; GeoListPlot[myCountries, ...

4

I'm definitely not proud of this, but here's a brute force method that is pretty accurate. First let's define some functions, cheating and using the built in GeoDistance function. We'll also try to minimize the error between the distances we're using as inputs and the distances we're calculating based on our guess {latitude, longitude}: geodist[pos1 : ...

4

I think you first need to start by generating the graphics with ListContourPlot. For example, take this arbitrary data as a 31x31 matrix: data = Table[Exp[-(90 - lat) Degree] Cos[lon Degree] + RandomReal[0.2], {lat, 60, 90}, {lon, -180, 180, 12}]; and construct the contour plot: g = ListContourPlot[data, Frame -> False, PlotRangePadding -> 0] Use ...

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