screen copy with postgis

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

screen copy with postgis

Olivier Leprêtre

Hi,

 

I'm trying to do a "screen copy" from a set of polygons. So I thought that I could use St_AsRaster and St_AsJpeg as follow, with the selection of two poly.

 

SELECT ST_AsJPEG(ST_AsRaster(st_collect((Select geom from poly where gid=605530),(Select geom from poly where gid=605533)),1000,1000, ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[255,255,255], ARRAY[0,0,0],null,null,0,0,true))

 

I load the result in a C# app which is in charge to save it as a file. This "works" but I'm loosing the boundaries (tha't to say the red lines in the image below).

 

1)    Is there a way to keep those boundaries ?

2)    As I have other layers, like texts, will it be possible to make them appear also, like a screen copy ?

 

In other words, more simply, am I on the right way or should I think to a completely different solution ?

 

Thanks,

 

Olivier

 




Avast logo

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
www.avast.com



_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: screen copy with postgis

Tumasgiu Rossini
Hi,

I'm not sure there is a function that can burns geometries on an existing
raster.

So I guess you will need to create a raster for each "layer" you want to
draw (e.g. the polygons, the boundaries...) and merge them into a
final raster using st_mapalgebra.

2017-02-22 21:48 GMT+01:00 Olivier Leprêtre <[hidden email]>:

Hi,

 

I'm trying to do a "screen copy" from a set of polygons. So I thought that I could use St_AsRaster and St_AsJpeg as follow, with the selection of two poly.

 

SELECT ST_AsJPEG(ST_AsRaster(st_collect((Select geom from poly where gid=605530),(Select geom from poly where gid=605533)),1000,1000, ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[255,255,255], ARRAY[0,0,0],null,null,0,0,true))

 

I load the result in a C# app which is in charge to save it as a file. This "works" but I'm loosing the boundaries (tha't to say the red lines in the image below).

 

1)    Is there a way to keep those boundaries ?

2)    As I have other layers, like texts, will it be possible to make them appear also, like a screen copy ?

 

In other words, more simply, am I on the right way or should I think to a completely different solution ?

 

Thanks,

 

Olivier

 




Avast logo

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
www.avast.com



_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: screen copy with postgis

Olivier Leprêtre

Hi,

 

Thanks for this answer Thomas, you confirm what I guessed also. Before considering this way, I had a look about attributes and didn't find how I could create raster texts layer, to display gid or other information. So I wonder if I should better not carrying on with Postgis for that but try another way...

 

Olivier

 

 

De : postgis-users [mailto:[hidden email]] De la part de Tumasgiu Rossini
Envoyé : mercredi 22 février 2017 22:56
À : PostGIS Users Discussion
Objet : Re: [postgis-users] screen copy with postgis

 

Hi,

I'm not sure there is a function that can burns geometries on an existing

raster.

So I guess you will need to create a raster for each "layer" you want to

draw (e.g. the polygons, the boundaries...) and merge them into a

final raster using st_mapalgebra.

 

2017-02-22 21:48 GMT+01:00 Olivier Leprêtre <[hidden email]>:

Hi,

 

I'm trying to do a "screen copy" from a set of polygons. So I thought that I could use St_AsRaster and St_AsJpeg as follow, with the selection of two poly.

 

SELECT ST_AsJPEG(ST_AsRaster(st_collect((Select geom from poly where gid=605530),(Select geom from poly where gid=605533)),1000,1000, ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[255,255,255], ARRAY[0,0,0],null,null,0,0,true))

 

I load the result in a C# app which is in charge to save it as a file. This "works" but I'm loosing the boundaries (tha't to say the red lines in the image below).

 

1)    Is there a way to keep those boundaries ?

2)    As I have other layers, like texts, will it be possible to make them appear also, like a screen copy ?

 

In other words, more simply, am I on the right way or should I think to a completely different solution ?

 

Thanks,

 

Olivier

 

cid:image001.jpg@01D28DB2.F9256BC0

 


Avast logo

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
www.avast.com

 


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

 




Avast logo

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
www.avast.com



_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: screen copy with postgis

Tumasgiu Rossini
I don't think there is a function to transform text into polygon
in postgis, though it can be feasible.

Looks like you gonna need to code a little more.

If you decide to stick to C#, you could use things like
dotspatial or sharpmap.
You could also just use the Npgqsl ADO connector to avoid
too many depedencies and do the math yourself.
Npgsql has built-in types for handling postgis geometries.

2017-02-23 8:58 GMT+01:00 Olivier Leprêtre <[hidden email]>:

Hi,

 

Thanks for this answer Thomas, you confirm what I guessed also. Before considering this way, I had a look about attributes and didn't find how I could create raster texts layer, to display gid or other information. So I wonder if I should better not carrying on with Postgis for that but try another way...

 

Olivier

 

 

De : postgis-users [mailto:[hidden email]] De la part de Tumasgiu Rossini
Envoyé : mercredi 22 février 2017 22:56
À : PostGIS Users Discussion
Objet : Re: [postgis-users] screen copy with postgis

 

Hi,

I'm not sure there is a function that can burns geometries on an existing

raster.

So I guess you will need to create a raster for each "layer" you want to

draw (e.g. the polygons, the boundaries...) and merge them into a

final raster using st_mapalgebra.

 

2017-02-22 21:48 GMT+01:00 Olivier Leprêtre <[hidden email]>:

Hi,

 

I'm trying to do a "screen copy" from a set of polygons. So I thought that I could use St_AsRaster and St_AsJpeg as follow, with the selection of two poly.

 

SELECT ST_AsJPEG(ST_AsRaster(st_collect((Select geom from poly where gid=605530),(Select geom from poly where gid=605533)),1000,1000, ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[255,255,255], ARRAY[0,0,0],null,null,0,0,true))

 

I load the result in a C# app which is in charge to save it as a file. This "works" but I'm loosing the boundaries (tha't to say the red lines in the image below).

 

1)    Is there a way to keep those boundaries ?

2)    As I have other layers, like texts, will it be possible to make them appear also, like a screen copy ?

 

In other words, more simply, am I on the right way or should I think to a completely different solution ?

 

Thanks,

 

Olivier

 

cid:image001.jpg@01D28DB2.F9256BC0

 


Avast logo

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
www.avast.com

 


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

 




Avast logo

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
www.avast.com



_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users