Questions tagged [matplotlib-basemap]

A library for plotting 2D data on maps in Python

Filter by
Sorted by
Tagged with
4 votes
1 answer
148 views

Clearing some lines in QGIS leads to features with no data

I'm trying to cut and delete some lines in a shapefile with QGIS. The output of this edit is the input to the Basemap.readshapefile function in matplotlib. My edited shapefile does not work well. It ...
Pythonist's user avatar
  • 379
0 votes
0 answers
24 views

How to edit with QGIS a shapefile without creating 3D shape types

I have edited a shapefile with QGIS where I have cut some polygons to get open lines. The original file works in my application, whereas the edited one does not. I'd like to understand what's going on ...
Pythonist's user avatar
  • 379
1 vote
1 answer
254 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, ...
David's user avatar
  • 133
1 vote
0 answers
355 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: ...
fisherking's user avatar
1 vote
0 answers
270 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 ...
JavierSando's user avatar
1 vote
1 answer
1k 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 ...
azis511's user avatar
  • 91
0 votes
0 answers
706 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 ...
a11's user avatar
  • 940
0 votes
0 answers
212 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. ...
BallpenMan's user avatar
  • 1,217
1 vote
0 answers
870 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/...
anc_ca's user avatar
  • 73
2 votes
0 answers
131 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....
carto-beginner's user avatar
1 vote
0 answers
214 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 ...
yqz09's user avatar
  • 11
1 vote
1 answer
279 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 ...
Felipe Gutierrez's 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?
Jarwin's 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 ...
naught101's user avatar
  • 496
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 ...
Light's 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=...
Mala Pokhrel's user avatar
3 votes
0 answers
848 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 ...
Yogesh Sathe's user avatar
0 votes
0 answers
623 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 ...
Dan Schien's user avatar
3 votes
1 answer
6k 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....
zxdawn's user avatar
  • 133
2 votes
1 answer
3k 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 =...
Damuno's user avatar
  • 111
9 votes
2 answers
10k 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 ...
user95048's 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 ...
mavroprovato's user avatar
1 vote
2 answers
8k 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'...
nerde1234's user avatar
  • 215
2 votes
2 answers
1k 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 ...
relima's user avatar
  • 2,810
3 votes
0 answers
452 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 ...
Luke Conibear's user avatar
1 vote
0 answers
159 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 ...
user26750's user avatar
  • 695
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.
vy32's user avatar
  • 269
4 votes
2 answers
23k 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 ...
vy32's user avatar
  • 269
1 vote
1 answer
96 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='...
mankoff's user avatar
  • 1,630
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 ...
dsbisht's user avatar
  • 695
1 vote
0 answers
911 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 ...
dsbisht's user avatar
  • 695
7 votes
1 answer
12k 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, ...
dsbisht's user avatar
  • 695
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 =...
dsbisht's user avatar
  • 695
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 ...
sundar_ima's user avatar
2 votes
0 answers
677 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 ...
martijnn2008's user avatar
0 votes
0 answers
192 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 ...
Alexis Eggermont's 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 ...
eos's user avatar
  • 285
1 vote
1 answer
2k 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-...
Einsteingen's user avatar
1 vote
0 answers
129 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 ...
El Dude's 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 ...
bjornasm's user avatar
  • 186
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 ...
lmart999's 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. ...
johnsmith's 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), ...
amaatouq's user avatar
  • 441
2 votes
1 answer
753 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?...
gustavgans's user avatar
2 votes
0 answers
638 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?
gustavgans's user avatar
1 vote
1 answer
422 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() ...
gustavgans's user avatar
0 votes
0 answers
792 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 ...
kamome's user avatar
  • 757
1 vote
1 answer
2k 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], ...
mankoff's user avatar
  • 1,630