Questions tagged [matplotlib-basemap]

A library for plotting 2D data on maps in Python

Filter by
Sorted by
Tagged with
1 vote
1 answer
121 views

Define your own latitude and longitude projection

I am converting (rotating) vectors from Lambert to latlon (and viceversa) in Python. But in Basemap or Cartopy, I see that you do not define the lat and lon projections, you just define your Lambert, ...
user avatar
  • 133
1 vote
0 answers
155 views

Plotting city locations on Python 3 [closed]

My question is a follow-up of this: plotting US cities on a map with matplotlib and basemap. I would like to use some Python library to plot on a map city locations, starting from a list like this: ...
user avatar
1 vote
0 answers
68 views

Getting the coordinates of the points inside of a shapefile/Getting the coordinates of the closest point if there are none

I'm working with an ERA5 (0.25x0.25 degree) temperature dataset for Europe in order to get average temperature in small statistical regions called NUTS 3. So far I've used a shapefile of the NUTS 3 ...
user avatar
1 vote
1 answer
567 views

Display GeoTIFF single band image in Python

I have a single band GeoTIFF image which displays correctly in QGIS. However I tried viewing the same file using matplotlib and rasterio but I get a different output. Is there something that I am ...
user avatar
  • 81
0 votes
0 answers
476 views

Matplotlib Basemap how to set EPSG to be consistent with new version of pyrpoj

I am getting a Matplotlib Basemap error related to pyproj and setting the EPSG. (I know Basemap is being depreciated, but this is what I am working in for now.) As a result, I can't plot the ...
user avatar
  • 881
0 votes
0 answers
124 views

When I get the total bounds of a shapefile, which are llcrnrlon, llcrnrlat, urcrnrlon, and urcrnrlat? Need it to use Maptlotlib Basemap

The goal is to use an ESRI webmap as a basemap beneath a shapefile for a script that visualizes earthquakes in the Philippines. But first, I'm practicing in using Basemap in a separate script. ...
user avatar
  • 1,102
1 vote
0 answers
608 views

Shapely “parallel_offset” with distance in meters from Lat/Lon coordinates

I need to find a LineString at a distance in meters from a line with coordinates in Lat/Lon. I am trying this approach based on what i found in this question https://stackoverflow.com/questions/...
user avatar
  • 73
2 votes
0 answers
102 views

Plotting Geopandas Gallery example fails?

I have been having trouble getting the figures from the example provided in Geopandas Gallery examples. When I ran these scripts in Jupyter console: import geopandas import geoplot import matplotlib....
user avatar
1 vote
0 answers
199 views

Basic Python plotting [closed]

Sorry if I sound like I don't understand, but I've been reading around trying to figure out how to do geospatial plotting in Python. I keep running into errors despite the examples I've seen appearing ...
user avatar
  • 11
1 vote
1 answer
188 views

Shifting data from a GRIB2 file

I have successfully opened a grib2 file from NCEP and I am having trouble being able to convert the coordinates to plot them using matplotlib, using the custom convertXY function from this post Plot ...
user avatar
3 votes
0 answers
2k views

draw map scale in geopandas

Is there a geopandas version of basemap's m.drawmapscale function? If not, can I somehow utilize basemap's drawmapscale function within geopandas?
user avatar
  • 131
3 votes
1 answer
2k views

Spreading/dispersing overlapping points?

I have a set of 150 sites globally, and I want to map them, and colour by a given variable. Unfortunately they are very non-uniformly distributed, with many of them in small clusters of only a few ...
user avatar
  • 458
1 vote
0 answers
2k views

Plotting Shapely polygons on basemap

I have some polygons and multipolygons created using latitudes and longitudes using shapely(there is no shapefile). I want to plot them using basemap. However they don't show up. When I use matplotlib ...
user avatar
  • 111
1 vote
1 answer
1k views

Can't import shapefile in Python

I am trying to plot district boundaries on a map of Nepal. For that I downloaded a shapefile of districts in Nepal from this site: http://www.arcgis.com/home/item.html?id=...
user avatar
2 votes
0 answers
720 views

All contours are not getting converted to shapefile in python

I am trying to create isoline plot for a weather parameter. Inputs are Lat, Lon and Value. They are read from csv file. When I plot the contours using matplotlib, the code works fine and generates ...
user avatar
0 votes
0 answers
545 views

Plot BNG grid data on Matplotlib Basemap

I would like to plot UK population density data in Matplotlib Basemap. I got data in ESRI ASCII using BNG OSGB63 from https://catalogue.ceh.ac.uk/documents/61f10c74-8c2c-4637-a274-5fa9b2e5ce44 and ...
user avatar
3 votes
1 answer
4k views

Smoothing the contour line in Python?

I used the NCEP 2.5 degree*2.5 degree data to plot the 850 mb wind field and heights. But, I didn't know how to smooth the contour line. Scipy.ndimage.zoom didn't work well and some details are missed....
user avatar
  • 133
2 votes
1 answer
2k views

Masking land with matplotlib basemap in Python?

I've been trying to mask land with .is_land from mpl_toolkits.basemap. When running following code: map = Basemap(llcrnrlon = 7.298914095230308, llcrnrlat = 58.98235690451632, urcrnrlon =...
user avatar
  • 101
9 votes
2 answers
7k views

Checking if a geocoordinate point is land or ocean?

I got the corner geo coordinates from a xml product file of a Sentinel-1 GRD SAR image. When looping through the pixels of the image I wish to check whether it represents land or sea. I figured I ...
user avatar
7 votes
1 answer
3k views

Unable to load a shapefile with Basemap

I'm try to load this shapefile with Basemap in order to plot it in Python: http://geodata.gov.gr/en/dataset/periphereies-elladas/resource/7c80a2c1-93b7-4814-9fc4-245e775acaa6 But I get the following ...
user avatar
0 votes
2 answers
7k views

Using Google Maps image as layer with Matplotlib Basemap?

I have produced a heat map of assaults in Sydney by suburb. However, my map looks a bit plain and I'd like to do something fancier - I'd like to use a Google Maps image as a background layer - I haven'...
user avatar
  • 195
2 votes
2 answers
974 views

How to interpolate data using basemap?

I have been trying for a long time now to make this simple basemap work. However, there is something with the format of the data basemap expects, which I cannot figure out. Can anybody help me ...
user avatar
  • 2,812
3 votes
0 answers
408 views

Raster flipping latitude or not showing shapefile on basemap

I am trying to save a 2D numpy array as a raster, and then split the raster using shapefiles. When I create the raster, I either have the problem of the latitude being flipped upside down, or that the ...
user avatar
1 vote
0 answers
150 views

Creating neat map in basemap using simplified boundaries?

Is it possible to create a neat map like using basemap (mpl_toolkits.basemap)? I am particularly curious to know if there's a way to "simplify" the boundaries as they are rather edgy in the ...
user avatar
  • 675
1 vote
1 answer
2k views

Get map from OpenStreetMap and use it as a background with basemap

I want to take a bounding box, use the OpenStreetMap API and get a tile, then use it as a background in basemap. This should be easy, but I haven't been able to figure out the API.
user avatar
  • 269
4 votes
2 answers
22k views

Get lat-long of US cities and plot them on a map using matplotlib and basemap [closed]

I am hosting a conference and want to show a map of where the attendees have arrived from. I have an input file with the names of the cities. I would like to put a dot on each city, and have the size ...
user avatar
  • 269
1 vote
1 answer
79 views

Matching Python and GRASS projection

I have a colleague producing maps with the following Python Basemap projection: from mpl_toolkits.basemap import Basemap m = Basemap(width=6000000,height=3900000, resolution='l',projection='...
user avatar
  • 1,588
2 votes
1 answer
3k views

Plotting classification map using shapefile in matplotlib?

"I have been struggling with python map plotting since past few days. I have realized that one can use python for plotting comparatively easy maps, but when one has to display detailed information, it ...
user avatar
  • 735
1 vote
0 answers
811 views

Raster and shapefiles are not overlapping in matplotlib?

I plotted a raster map using matplotlib. When I overlay a shapefile, the raster seems to be shifted a bit. The same raster and shapefile overlap each other perfectly in ArcGIS. Here is what I am ...
user avatar
  • 735
7 votes
1 answer
11k views

Plotting raster maps in python?

I am trying to plot raster map using Pyhton. Image is not being saved, though it appears. Moreover, pixels are not appearing on the exact place. I am getting image as shown below (which is WRONG, ...
user avatar
  • 735
1 vote
1 answer
2k views

Hide meridians and parallel lines from plot and add TICK marks in matplotlib?

I want to hide the meridian and parallel lines from my plot and add the tick marks. I could remove the lines by setting linewidth=0, but how to add the tick marks with each Lat-Lon label. meridians =...
user avatar
  • 735
1 vote
0 answers
3k views

Reading shapefile faster using Python basemap (and pickle)

I am trying to plot a simple 'merc' map with boundary from shapefile. The total size of the shapefile ne_10m_admin_0_countries_lakes.shp is just 8mb. The simple mslp surface plot from GFS data took ...
user avatar
2 votes
0 answers
577 views

Grid parameter restriction of mpl_toolkits.basemap.maskoceans

I have plotted the image below with the use of matplotlib and mpl_toolkits.basemap. However I am not satisfied with the result. The image is still very blocky near the coast line. The grid parameter ...
user avatar
0 votes
0 answers
176 views

Number of polygons in shapefile too high

I downloaded administrative shapefiles from www.gadm.com/country (China). The Python (Basemap) code below tells me that there are 2365 polygons in it. However the .csv and .dbf files included with the ...
user avatar
0 votes
1 answer
2k views

Why do pyproj and matplotlib basemap produce different results when they convert my lat-long data into a CRS?

pyproj and matplotlib basemap seem to produce differing x-y values when they convert my lat-long data into the same CRS (such as Albers Equal Area). These x-y values tend to be off by hundreds of ...
user avatar
  • 285
1 vote
1 answer
1k views

Adding map from website maps-for-free.com as basemap on QGIS?

How can I add map from maps-for-free.com as my base map on QGIS 2.10 Pisa? My operating system is Windows 7, x64 bit. @Spacedman. Here, I've gone to ~/.qgis2-->python-->plugins-->quick_map_services-...
user avatar
1 vote
0 answers
102 views

Matplotlib Basemap Coastal Coordinates

Is there a way to query basemap to extract all coastal coordinates? Say user provides lat/lng and the function returns true/false if the coordinates are within 1km from the coast? Links are more than ...
user avatar
  • 181
1 vote
0 answers
2k views

Using arcgisimage along with python basemap

I am utilizing maps provided through the ArcGIS rest service when i plot information in Python, but have some problems understanding the different options I have when I request I map. The ...
user avatar
  • 157
0 votes
1 answer
2k views

Shapefile projection for Matplotlib Basemap

Preface: First time working with GIS data. I'm using python's Basemap library for overlaying data on maps. The tutorial I'm using includes a shapefile for London (london_wards.shp). I use the ...
user avatar
  • 103
1 vote
2 answers
2k views

Why can't Basemap's readshapefile read the world_adm0 shapefile?

I'm using the world shapefile that can be found at https://trac.openstreetmap.org/browser/applications/editors/merkaartor-branches/merkaartor-0.14-fixes/share/world_shp/world_adm0.shp?rev=17052. ...
user avatar
  • 141
2 votes
1 answer
1k views

Python Basemap fails

I am using Anaconda 2.1.0 and Basemap installation is successful conda install basemap However, I keep getting the following error when I try to project lat,lon to a planar: Assertion failed: (0), ...
user avatar
  • 441
2 votes
1 answer
624 views

QGIS: how to combine a GeoTIFF with a country border shapefile?

I have two files. A GeoTIFF with different values and a shapefile with country borders of this area. Can I generate with these two files an image with the country borders and the data from the GeoTIFF?...
user avatar
1 vote
0 answers
562 views

How to update country borders in matplotlib.basemap?

I'm using basemap-1.0.7 and generated an image of Africa with the drawcountries() method. The border between Sudan and South Sudan is missing. Does someone know how to update this country borders?
user avatar
1 vote
1 answer
340 views

how to transfer a geotif with WGS84 to a mercator array for ploting it with matplotlib.basemap

I want to plot data from a sensor raster file (tif) to a map using basemap. I have a geotif with 'WGS 84' >>> gtif = gdal.Open("example.tif") >>> print gtif.GetProjectionRef() ...
user avatar
0 votes
0 answers
733 views

Freezing basemap using cx_freeze

I am working on script and I´d like to freeze it for use in computers who haven´t got python installed- The script is running fine but when I freeze it using cx_freeze an error appears. at the end ...
user avatar
  • 737
1 vote
1 answer
1k views

Orthographic projection in Python Basemap

I'm trying to plot a GeoTIFF in Python using Basemap. I can do so correctly with cyl projection like this: m = Basemap(projection='cyl', llcrnrlat=LL[1], urcrnrlat=UR[1], ...
user avatar
  • 1,588