-
Notifications
You must be signed in to change notification settings - Fork 24
RL2_GetMapImage from geopaparazzi 01
Mark Johnson edited this page Mar 8, 2018
·
15 revisions
First attempt to retrieve a RasterLite2 Image from spatialite database with RasterLite2 images
--
-
SpatialiteUtilities.
- public static byte[] rl2_GetMapImage( Database sqlite_db,String sourceSrid, String destSrid, String coverageName, int width, int height, double n, double s, double e, double w, String styleName, String mimeType, String bgColor, int transparent, int quality, int reaspect )
- Retrieve a portion of the Raster-Image
- as
TILE
- here
jpeg
was used, since thepng
was not very good
- here
- as
05-19 09:33:19.855 15220 15244 I GEOPAPARAZZI: SpatialiteUtilities:
rl2_GetMapImage sql[
SELECT RL2_GetMapImage('berlin_stadtteilgrenzen.1880',
ST_Transform
(
BuildMBR(13.377227783,52.517056554,13.378601074,52.516220864,4326),
3068
),256,256,'default','image/jpeg','#ffffff',0,80,0);]
05-19 09:33:19.905 15220 15244 I GEOPAPARAZZI: FileUtilities
[/storage/emulated/0/maps/spatialite_versions/
1890.berlin_stadt_postgrenzen_rasterlite2.db.tile.jpg]
data.length[9079]
-
- the time needed in geopaparazzi
0.05 seconds
- the time needed in geopaparazzi
- the area of the 1:5000 Map (423C_42348) in Berlin :
- image retrieved with
SELECT RL2_GetMapImage(..)
- result save to file
FileUtilities.writefiledata
- image retrieved with
public byte[] getRasterlite2Tile(SpatialRasterTable rasterTable ) {
byte[] bytes = null;
String sourceSrid=rasterTable.getSrid();
String destSrid=rasterTable.getSrid();
// berlin_postgrenzen.1890;LOSSY_WEBP;RasterLite2;Berlin Straube Postgrenzen;1890 - 1:17777;
String coverageName=rasterTable.getTableName();
coverageName="berlin_stadtteilgrenzen.1880";
int width=1500;
int height=1100;
// int width=5000;
// int height=3800;
double n=22000.000;
double s=19600.000;
double e=24000.000;
double w=20800.000;
String styleName="default";
String mimeType="image/png";
String bgColor="#ffffff";
int transparent=0;
int quality=0;
int reaspect=1;
bytes=SpatialiteUtilities.rl2_GetMapImage(db_java,sourceSrid,destSrid,coverageName, width,height,n,s,e,w,
styleName, mimeType,bgColor,transparent,quality,reaspect );
if (bytes != null) {
try {
eu.geopaparazzi.library.util.FileUtilities.writefiledata(bytes,rasterTable.getDatabasePath()+".png");
} catch (IOException ex) {}
return bytes;
}
return null;
}
/*
05-19 08:03:41.802 3537 3560 I GEOPAPARAZZI: SpatialiteUtilities:
rl2_GetMapImage sql[
SELECT RL2_GetMapImage
(
'berlin_stadtteilgrenzen.1880',
BuildMBR(20800.0,22000.0,24000.0,19600.0),
1500,1100,'default','image/png','#ffffff',0,0,1
);
]
05-19 08:03:46.707 3537 3560 I GEOPAPARAZZI:
FileUtilities[/storage/emulated/0/maps/spatialite_versions/1890.berlin_stadt_postgrenzen_rasterlite2.db.png] data.length[3257055]
*/
-
- the time needed in geopaparazzi
4.905 seconds
- the time needed in geopaparazzi
-- big image requests fail
-
SpatialiteUtilities.rl2_GetMapImage
- the application dies
this internal lib error is not being caught and the application crashes
- the request was for a image 1/3 of the orignal size of 10607x8292 (3535x2764)
- big images should be avoided, since the application dies
'libc : Fatal signal 11 (SIGSEGV) at 0x80c7a000 (code=1), thread 4216 (AsyncTask #2)'
'/data/app-lib/eu.hydrologis.geopaparazzi-2/libjsqlite.so (rl2_raster_decode+8248)'
'I WindowState: WIN DEATH: Window{41ee0100 u0 eu.hydrologis.geopaparazzi/eu.hydrologis.geopaparazzi.GeoPaparazziActivity}'
2014-05-20: Mark Johnson, Berlin Germany