[Proj] placing a matplotlib basemap plot on a google map

dzengiz.tafa at telenet.be dzengiz.tafa at telenet.be
Wed Jun 1 03:51:27 EST 2016


Hi 

For quite some time now I've been wresteling with a problem concerning projections. I was wondering if the experts on this forum/mailinglist could be of any help, since (let's face it) the material is quite frankly over my head. 

The short story is that I have got an hdf5 radar image, which contains an x-y grid of pixelvalues and I have to place it on a google map. Already there's a problem because the data is purely an x-y grid and google maps uses the EPSG 3857projection. The proj4 string provided in the hdf5 file is one of the RD-coordinate system, a system used in the Netherlands. 

The rest of the information I can find is listed here 


cal_data_count = 0 
cal_method = None 
cal_stations_count = 0 
composite_count = 288 
declutter_history = 0.1 
declutter_size = 4.0 
fill_value = -9999 
grid_extent = -110000,390000,700000,210000 
grid_projection = PROJCS["unnamed",GEOGCS["Bessel 1841",DATUM["unknown",SPHEROID["bessel",6377397.155,299.1528128],TOWGS84[565.237,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Oblique_Stereographic"],PARAMETER["latitude_of_origin",52.15616055555555],PARAMETER["central_meridian",5.38763888888889],PARAMETER["scale_factor",0.999908],PARAMETER["false_easting",155000],PARAMETER["false_northing",463000],UNIT["Meter",1]] 
grid_size = 500,490 
locations = -7384.887748796755,358296.0214553905,140661.4380856066,456959.9690822229,115509.8972636278,551852.1442379927,263965.23587302887,595812.4921183779,264883.22682543105,380702.99609763426,238048.54530185566,236013.44861746818 
method = weighted lowest altitudes 
radars = JAB,NL60,NL61,emd,ess,nhb 
ranges = 298.75,239.5,239.5,127.5,127.5,127.5 
timestamp_first_composite = 20151211080000 
timestamp_last_composite = 20151212075500 

map_projection (6024, 2) 
Group size = 0 
Number of attributes = 3 
projection_indication = Y 
projection_name = STEREOGRAPHIC 
projection_proj4_params = +proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.237,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +units=m +no_defs 

geographic (5200, 2) 
Group size = 1 
Number of attributes = 8 
geo_dim_pixel = KM,KM 
geo_number_columns = 500 
geo_number_rows = 490 
geo_par_pixel = X,Y 
geo_pixel_def = CENTRE 
geo_pixel_size_x = 1.0 
geo_pixel_size_y = -1.0 
geo_product_corners = -110000,210000,-110000,700000,390000,700000,390000,210000 
Right now I am using a complex code to rewrite each of the pixels to lat/lon & I plot them with matplotlib (python) on a mpl basemap without landcontours, coast-contours so I have an image on an mpl-basemap, but as said, without the countrycontours & such. The projecction used for the Basemap is "mercator". The result gives the desired radarimage & seems to match the locations... so far so good but with the python mapping of pixels to lat/lons... 

I then run the output (a png file) through gdal to tile it, & warp it to the EPSG 3857 projection (Gmaps). When turning on the country-contours to check the result, the result is not correct, although it comes close to what it should be. 

http://postimg.org/image/ly01obb1n/ 

I am starting to wonder if there's another way I can make this work, perhaps without the use of matplotlib python? Eg, going from the standard x-y grid Hdf5 data straight to a warp using gdal or whichever way possible. I have run out of ideas & the information I can find to help me get passed this is really confusing. 


I am looking forward to the reply of the masters in this forum. 


Best regards 

D. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20160601/c8c79b1d/attachment.htm 


More information about the Proj mailing list