# Tag Info

## Hot answers tagged geography

40

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

24

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

23

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

20

Well I do not have your data, so I'll just show things I have. I'll go with India, it has nice cities layout. You can upgrade for your data yourself. If you know only locations of cities, but not their population, then data = DeleteCases[ Reverse[CityData[#, "Coordinates"]] & /@ CityData[{All, "India"}], Missing["NotAvailable"]]; ...

19

Due to the limitations on the accuracy of SmoothKernelDistribution (mentioned by Murta) upon which SmoothDensityHistogram is based, I prefer to work with the more exact KernelMixtureDistribution. I will use the same data as Vitaliy here. data = DeleteCases[ Reverse[CityData[#, "Coordinates"]] & /@ CityData[{All, "India"}], ...

18

You can use your ContourPlot, you just need to wrap coordinates with GeoPosition, note that you have to flip order. (if x is longitude and y is latitude, because GeoPosition assumes first is latitude and so on.) cp is Graphics[GraphicsComplex[coordinates, primitives]...], it is convenient to use this form. We can apply GeoPosition in one place and reduce ...

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

16

Please see the Utility function section for a concise summary. An arbitrary density plot for the example: den = DensityPlot[Sin[x] Sin[y], {x, -180, 180}, {y, -90, 90}] : Extract the graphics primitives from the density plot: prim = First @ Cases[den, Graphics[a_, ___] :> a, {0, -1}, 1]; Plot them directly with GeoGraphics while setting the ...

15

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

15

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

14

I take a screenshot of your image and assign it to the image variable. In[2]:= ImageDimensions[image] Out[2]= {1326, 1150} This computes the positions of the lines in your image: In[3]:= lines = ImageLines[Binarize[ColorDistance[image, Gray], {0, .4}]] Out[3]= {{{0., 638.044}, {1326., 638.044}}, {{0., 132.694}, {1326., 132.694}}, {{0., 891.219}, {1326., ...

14

It is version 10.0 specific bug. Please upgrade to a more recent version Version 10.0.0: Version 10.1 and above: Tested on Linux. It seems that other OS have the same behavior. One can extract proper options from recent version and put them to 10.0.0: GeoGraphics[Polygon@Entity["Country", "Russia"], GeoProjection -> {"LambertAzimuthal", ...

13

Here's just a different suggestion. Playing around with the parameters can yield very different results, so it's encouraged. I'm using the same data as Vitaliy: data = DeleteCases[Reverse[CityData[#, "Coordinates"]] & /@ CityData[{All, "India"}], Missing["NotAvailable"]]; outline = ColorNegate@Graphics[CountryData["India", "Polygon"]]; My solution ...

13

There is no built in option, however for the US it's very easy because the coordinates of the state borderlines are all over the Internet. This led me to one such data set. I'll include how I cleaned it up, like this: data = Import["http://econym.org.uk/gmap/states.xml"]; name[{"name" -> n_, ___}] := n coordinates[XMLElement["point", {"lat" -> lat_, ...

13

There is an example of what I think you are trying to do at the end of WeatherData help page, but its a little hard to read. However - here's what I think you want. (* Function to Get a list consisting of {CityName, Temp, Co-ords} given a Countries weather station, note we get the 1st nearest weather station to the city *) weatherdata[cityname_] := ...

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

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

12

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

12

The polygon of interest is state = Entity["AdministrativeDivision", {"Illinois", "UnitedStates"}]; (polygon = state["Polygon"]) // Short (* Polygon[GeoPosition[{{{36.9821, -89.1329}, <<187>> ,{36.9821, -89.1329}}}]] *) however that expression is not a valid region RegionQ[polygon] (* False *) because the argument of Polygon[] is not a ...

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

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

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.

10

I really don't get it. But here's work around. It seems that within projected area is everything with longitude in interval: {t-180, t+180} and if you set t = -180 algorithm does not care that it is plotting {-360 , 0} while oryginal data has domain {-180, 180}. We have to take care wbout Mod ourselvs: pos = Cases[ CountryData["World", ...

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

I would prefer to use the "GeoImage" styling, because you can use other projections when using it. Let's say you have data for the whole world in a matrix: data = Table[ Sin[x Degree] Sin[y Degree], {y, -90, 90}, {x, -180, 180}] Then you use ListDensityPlot: den1 = ListDensityPlot[data, AspectRatio -> 1/2, Frame -> None, PlotRangePadding ...

9

You can use GeoNearest to find all counties that are distance zero away from something, e.g. a body of water. Here's the Gulf of Mexico: border = GeoNearest["USCounty", Entity["Ocean", "GulfMexico"], {All, 0}]; GeoGraphics[{Red, EdgeForm[Black], Polygon[border]}]

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

8

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

8

WeatherData can be told to give you all the weather stations it knows about, but there's more than one type of weather station (and duplicates!): allWeatherStations = WeatherData[]; fullformStations = FullForm /@ allWeatherStations; Tally[StringLength /@ fullformStations[[All, 1, 2]]] (*{{4, 6919}, {5, 10306}, {8, 4697}}*) Looking at the documentation, I ...

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