problem using st_colormap in a command string

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

problem using st_colormap in a command string

Liglio Cavalcante
Hi,

I have a problem to separate lines in the argument "colormap". I am using a
npgsql driver, and concatenating a command string to use the function
st_colormap. What can I use to break lines ?

-- This is not working: Chr(10) = ASCII LineFeed
strColorMap &= "nv 0 0 0 0" & Chr(10)
strCores &= val_nivel1 & " 255 0 145 255" & Chr(10)
strCores &= val_nivel2 & " 181 19 111 255" & Chr(10)
strCores &= val_nivel3 & " 19 0 104 255" & Chr(10)
strCommand = "SELECT ST_ColorMap( rast, '" + strColorMap + "') as rast FROM
tb_rasterdensity"

To look like this:
ST_ColorMap( rast,
'nv 0 0 0 0
0.5 255 0 145 255
1 181 19 111 255
3 19 0 104 255
') as rast FROM tb_rasterdensity)




--
View this message in context: http://postgis.17.x6.nabble.com/problem-using-st-colormap-in-a-command-string-tp5010778.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problem using st_colormap in a command string

Tumasgiu Rossini
Hi,
this is not really a postgis question.
According to npgsql website, the best way to get answers
is to post questions on stackoverflow.net with the npgsql tag.

However, to answer your question, you can use the Environement.Newline property
to create a string value containing line feeds.
Note that this property will output \r\n
or \n depending of the platform running your code (NT \ linux).
Note that the interpretation of the sequence will depend of your platform too.

If you just want to lay an instruction over mutliple line,
you can add a _ at the end of each line (except the last one).

2016-12-28 21:57 GMT+01:00 Liglio Cavalcante <[hidden email]>:
Hi,

I have a problem to separate lines in the argument "colormap". I am using a
npgsql driver, and concatenating a command string to use the function
st_colormap. What can I use to break lines ?

-- This is not working: Chr(10) = ASCII LineFeed
strColorMap &= "nv 0 0 0 0" & Chr(10)
strCores &= val_nivel1 & " 255 0 145 255" & Chr(10)
strCores &= val_nivel2 & " 181 19 111 255" & Chr(10)
strCores &= val_nivel3 & " 19 0 104 255" & Chr(10)
strCommand = "SELECT ST_ColorMap( rast, '" + strColorMap + "') as rast FROM
tb_rasterdensity"

To look like this:
ST_ColorMap( rast,
'nv 0 0 0 0
0.5 255 0 145 255
1 181 19 111 255
3 19 0 104 255
') as rast FROM tb_rasterdensity)




--
View this message in context: http://postgis.17.x6.nabble.com/problem-using-st-colormap-in-a-command-string-tp5010778.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users


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

Re: problem using st_colormap in a command string

Liglio Cavalcante
I already tried several characters, including "Environement.Newline", "\r\n",
Chr(15), Chr(13). It does not work, the string looks like this using Chr(13)
in a VB.NET code:

SELECT ST_ColorMap( rast, '" & vbCr & "nv 0 0 0 0" & vbCr & "0.5 255 0 145
255" & vbCr & "1 181 19 111  255" & vbCr & "3 19 0 104  255" & vbCr & "') as
rast FROM tb_rasterdensity, 'GTiff', NULL, 4326)

Maybe the st_colormap, must implement a character to be interpreted to a
line feed (ex: "|").





--
View this message in context: http://postgis.17.x6.nabble.com/problem-using-st-colormap-in-a-command-string-tp5010778p5010780.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problem using st_colormap in a command string

Tumasgiu Rossini
Excuse me, I readed this too fast.
Maybe it is because you missed the E modifier before the string literal ?

2016-12-29 0:15 GMT+01:00 Liglio Cavalcante <[hidden email]>:
I already tried several characters, including "Environement.Newline", "\r\n",
Chr(15), Chr(13). It does not work, the string looks like this using Chr(13)
in a VB.NET code:

SELECT ST_ColorMap( rast, '" & vbCr & "nv 0 0 0 0" & vbCr & "0.5 255 0 145
255" & vbCr & "1 181 19 111  255" & vbCr & "3 19 0 104  255" & vbCr & "') as
rast FROM tb_rasterdensity, 'GTiff', NULL, 4326)

Maybe the st_colormap, must implement a character to be interpreted to a
line feed (ex: "|").





--
View this message in context: http://postgis.17.x6.nabble.com/problem-using-st-colormap-in-a-command-string-tp5010778p5010780.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users


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

Re: problem using st_colormap in a command string

Liglio Cavalcante
I 'm sorry, but I don't understand "missed the E modifier before the string
literal". Can you show me in my code ?



--
View this message in context: http://postgis.17.x6.nabble.com/problem-using-st-colormap-in-a-command-string-tp5010778p5010784.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problem using st_colormap in a command string

Tumasgiu Rossini
Sure :

   strColorMap &= "nv 0 0 0 0\n"
   strCores &= val_nivel1 & " 255 0 145 255\n"
   strCores &= val_nivel2 & " 181 19 111 255\n"
   strCores &= val_nivel3 & " 19 0 104 255\n"
   strCommand = "SELECT ST_ColorMap( rast, E'" + strColorMap + "') as rast FROM tb_rasterdensity"

See www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html  4.1.2.2.

2016-12-29 13:57 GMT+01:00 Liglio Cavalcante <[hidden email]>:
I 'm sorry, but I don't understand "missed the E modifier before the string
literal". Can you show me in my code ?



--
View this message in context: http://postgis.17.x6.nabble.com/problem-using-st-colormap-in-a-command-string-tp5010778p5010784.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users


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