Re: [mapserver-users] Curved Lines

2012-06-27 Thread Mr. Puneet Kishor

On Jun 27, 2012, at 2:13 AM, juliap wrote:

> Hi all,
> 
> I have the following layer of type line :
> 
> LAYER 
>   NAME line
>   STATUS ON
>   TYPE LINE
>   CONNECTIONTYPE OGR  
>   CONNECTION "MSSQL:server=server;database=database;uid=id;pwd=pwd" 
>   DATA "SELECT geometry::STLineFromText('LINESTRING ('
> +CAST(Geo.STX AS VARCHAR(54))
> +' '
> +CAST(Geo.STY AS VARCHAR(54))
> +', '
> +CAST(Geo.STX AS VARCHAR(54))
> +' '
> +CAST(Geo.STY AS VARCHAR(54)) 
> +')'
> ,4326)
>   FROM column WHERE DATEDIFF(mi, CreatedON, CURRENT_TIMESTAMP) <='%x%'"   
> 
>   CLASS
>   STYLE   
>   WIDTH 3
>   SIZE 1
>   COLOR 0 0 128
>   END # end of style
>   END # end of class
>   PROJECTION
>   "init=epsg:4326" 
>   END # end of projection
> END # end of layer
> 
> I was wondering how to get a curved line from this data. I tried using angle
> and gap, but I don't see any changes.
> Any suggestions?
> 


Your understanding of geometry is a bit off here. In a query result set, each 
row is a feature, and a line feature would be made up of two or points; a 
curved line feature, of course, would be made up of three or more points.

What you are getting in the result set above is a bunch of features, each of 
which are a point repeated twice. I think what you really want is to create a 
single line feature from all these points. So, you would probably do some kind 
of an aggregate on these points. I don't know the functions available in SQL 
Server, but there must be an analog for Postgres's aggregate functions. You 
want to collect all the points and make a line feature from them, and then pass 
that to MapServer to draw. You could make a view that does all this, and then 
call the view from MapServer.

Hope this helps.


--
Puneet Kishor
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Curved Lines

2012-06-27 Thread Mr. Puneet Kishor

On Jun 27, 2012, at 8:17 PM, Rahkonen Jukka wrote:

> Hi,
> 
> The question, if I understand is correctly, is relevant. In EPSG:4326 
> shortest distance between two points is better expressed as a curve than as a 
> straight linestring. However, Mapserver does not support curves of any kind.


Interesting spin; didn't think of that. However, note that, as Brent pointed 
out, the OP is SELECTing the same coords twice, so, in effect, they are two 
coincident points of line length zero.



> 
> You may find some workaround from GDAL. Ogr2ogr is having a "segmentize" 
> option for this purpose. It does not support real curves either, but it 
> creates intermediate points so that linestrings are shorter and thus follow 
> the curve better. See http://gdal.org/ogr2ogr.html
> 
> -Jukka Rahkonen-
> 
>> -Alkuperäinen viesti-
>> Lähettäjä: mapserver-users-boun...@lists.osgeo.org 
>> [mailto:mapserver-users-boun...@lists.osgeo.org] Puolesta Mr. 
>> Puneet Kishor
>> Lähetetty: 27. kesäkuuta 2012 17:39
>> Vastaanottaja: juliap
>> Kopio: mapserver-users@lists.osgeo.org
>> Aihe: Re: [mapserver-users] Curved Lines
>> 
>> 
>> On Jun 27, 2012, at 2:13 AM, juliap wrote:
>> 
>>> Hi all,
>>> 
>>> I have the following layer of type line :
>>> 
>>> LAYER 
>>> NAME line
>>> STATUS ON
>>> TYPE LINE
>>> CONNECTIONTYPE OGR  
>>> CONNECTION 
>> "MSSQL:server=server;database=database;uid=id;pwd=pwd" 
>>> DATA "SELECT geometry::STLineFromText('LINESTRING ('
>>>   +CAST(Geo.STX AS VARCHAR(54))
>>>   +' '
>>>   +CAST(Geo.STY AS VARCHAR(54))
>>>   +', '
>>>   +CAST(Geo.STX AS VARCHAR(54))
>>>   +' '
>>>   +CAST(Geo.STY AS VARCHAR(54)) 
>>>   +')'
>>>   ,4326)
>>> FROM column WHERE DATEDIFF(mi, CreatedON, 
>> CURRENT_TIMESTAMP) <='%x%'"  
>>> CLASS
>>> STYLE   
>>> WIDTH 3
>>> SIZE 1
>>> COLOR 0 0 128
>>> END # end of style
>>> END # end of class
>>> PROJECTION
>>> "init=epsg:4326" 
>>> END # end of projection
>>> END # end of layer
>>> 
>>> I was wondering how to get a curved line from this data. I 
>> tried using angle
>>> and gap, but I don't see any changes.
>>> Any suggestions?
>>> 
>> 
>> 
>> Your understanding of geometry is a bit off here. In a query 
>> result set, each row is a feature, and a line feature would 
>> be made up of two or points; a curved line feature, of 
>> course, would be made up of three or more points.
>> 
>> What you are getting in the result set above is a bunch of 
>> features, each of which are a point repeated twice. I think 
>> what you really want is to create a single line feature from 
>> all these points. So, you would probably do some kind of an 
>> aggregate on these points. I don't know the functions 
>> available in SQL Server, but there must be an analog for 
>> Postgres's aggregate functions. You want to collect all the 
>> points and make a line feature from them, and then pass that 
>> to MapServer to draw. You could make a view that does all 
>> this, and then call the view from MapServer.
>> 
>> Hope this helps.
>> 
>> 
>> --
>> Puneet Kishor
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapServer vs ArcGIS server

2012-07-03 Thread Mr. Puneet Kishor

On Jul 4, 2012, at 6:03 AM, Wang, Ya wrote:

> Mike:
> Thank you very much for the sharing. It is really great information. I have 
> another question now.  How does MapServer compare with ArcGIS server in terms 
> of providing API or service layers to support the enthusiasm of the online 
> development community?
> ..

Why don't you summarize for us how and what ArcGIS Server provides in terms of 
"API or service layers" and how it supports the enthusiasm of its online 
development community? That knowledge would benefit several of us, I believe.

Also, try asking the same question on the ArcGIS Server email list, if there is 
one, and then summarize the responses you get there. I would be very curious to 
read those.

Finally, wrt MapServer's programming hooks and APIs, have you visited the docs 
at http://mapserver.org? Lots of great, entirely community developed 
information there. Remember, no one owns MapServer -- you and I and others and 
everyone owns it.




--
Puneet Kishor
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapServer and shapefile

2012-10-04 Thread Mr. Puneet Kishor

On Oct 4, 2012, at 10:56 PM, Fabio Brolese  wrote:

> Trying using shapefile as base layer I didn't find where to put my shapefile 
> and to let them seen by MapServer. The examples say me to set the map file 
> correctly but not where to save the shp files how to say to MapServer where 
> thay are. Is there a directive in the main map file where to set the location 
> of shp files like I set the log file path and etc.
> 
> 

http://mapserver.org/mapfile/map.html

MAP
  SHAPEPATH [filename]
Path to the directory holding the shapefiles or tiles. 
There can be further subdirectories under SHAPEPATH.




http://mapserver.org/mapfile/layer.html

LAYER
  DATA [filename]|[sde parameters][postgis table/column][oracle table/column]
Full filename of the spatial data to process. No file 
extension is necessary for shapefiles. Can be specified 
relative to the SHAPEPATH option from the Map Object.






> 
> 
> 
> 
> 
>> 
>> Da: Cristiano Sumariva 
>> A: Fabio Brolese  
>> Inviato: Martedì 2 Ottobre 2012 13:14
>> Oggetto: Re: [mapserver-users] MapServer and shapefile
>> 
>> 
>> If your map vector is not huge, and processing time is not a problem - 
>> something greater then a few seconds for a tile - you can use a WMS layer as 
>> base.
>> Just add isBaseLayer true to parameter options on layer.
>> This should be minimal to change.
>> At my sites I did not note WMS overhead on requests.
>> You should know that OpenLayers is greed and will issue several concurrent 
>> requests to server. Processing spikes will happen.
>> 
>> 
>> For larger sets you maybe at the need of some cache stuff.
>> Consider using one in a programming language you know in case you need do 
>> maintenance in source code.
>> Or if confortable with some, create your particular simple cache maybe an 
>> option.
>> 
>> 
>> 2012/10/2 Fabio Brolese 
>> 
>> Yes, sorry, I was talking about OpenLayers.
>>> I understood and is like I did with all the layers I set pointing on 
>>> PostGIS. I have also a "base layer" set as OpenLayers.Layer.TMS that load 
>>> image tiles to show the city map. What we want to do is to change the base 
>>> layer to read the city map from shapfile instead of reading image tiles.
>>> 
>>> 
>>> Do you know if there is a way to do what we want or do I have to reconsider 
>>> my structure and consider and use it as OpenLayers.Layer.WMS?
>>> 
>>> 
>>> Fabio
>>> 
>>> 
>>> 
>>> 
>>> 
 
 Da: Rahkonen Jukka 
 A: "mapserver-users@lists.osgeo.org"  
 Inviato: Martedì 2 Ottobre 2012 9:05
 Oggetto: Re: [mapserver-users] MapServer and shapefile
 
 
 Hi,
 
 Because you talk about base layer I think that you are perhaps going to 
 show your map in OpenLayers. If that is the case then the answer is yes 
 and this OpenLayers example shows how it can be done.
 http://dev.openlayers.org/releases/OpenLayers-2.12/examples/wms-untiled.html
 On the Mapserver side you must configure a WMS layer that is using 
 shapefile as
> input data.
 http://www.mapserver.org/ogc/wms_server.html
 
 
 -Jukka Rahkonen-
 
 Fabio Brolese wrote:
 
> Hello everybody,
> after a long search on Google I'm here to ask you if it's possible to use 
> a shapefile as base layer.
> Everything I found was on exporting to shapefile or drawing objects from 
> shapefile but nothing saying that I can >use it as base layer.
 
 Can anyone help me?
 
 TIA
 
 Fabio
 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users
 
 
 
>>> ___
>>> mapserver-users mailing list
>>> mapserver-users@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>> 
>>> 
>> 
>> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] [mapserver-dev] MapServer 6.2 released

2012-11-14 Thread Mr. Puneet Kishor
As my work focuses more and more on the outer envelope of science and data, 
this reminds me more and more of how much we all owe to the work you guys do at 
the core.

Much gratitude and respect.

--
Puneet Kishor
Science and Data Policy at Creative Commons



On Nov 14, 2012, at 7:15 AM, "Lime, Steve D (DNR)"  
wrote:

> And on GIS Day no less… nice timing. Fabulous work by all those that 
> contributed code. A special shout out to Thomas for handling the release 
> manager role. Thanks everyone!
> 
> Steve
> 
> From: mapserver-dev-boun...@lists.osgeo.org 
> [mailto:mapserver-dev-boun...@lists.osgeo.org] On Behalf Of thomas bonfort
> Sent: Wednesday, November 14, 2012 9:03 AM
> To: MapServer Dev Mailing List; MapserverList OSGEO; osgeo-discuss 
> (disc...@lists.osgeo.org)
> Subject: [mapserver-dev] MapServer 6.2 released
> 
> The MapServer team is pleased to announce the release of MapServer 6.2, along 
> with the joint release of tinyOWS 1.1.0 and MapCache 1.0.0.
> 
> Details of the new features, migration instructions, and download links can 
> be found on the dedicated announcement page at 
> http://www.mapserver.org/development/announce/6-2.html .
> 
> cheers,
> The MapServer PSC









___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Mapserver useful for ordinary sites or not?

2012-12-05 Thread Mr. Puneet Kishor

On Dec 5, 2012, at 9:40 AM, Saka Royban  wrote:

> Hi guys 
> After a lot of effort to use CGI mapserver in my own site and finally leaving 
> hope to find a solution, i came here to ask whether maserver is useful just 
> for dedicated servers or VPSs really? 
> I (and as it sounds, most of users) have just bought some space from a host 
> provider (i.e Linux) with a CGI-bin directory which as my host provider says 
> is able to run CGI applications written in perl and C/C++.
> 
> I have searched a lot but as it appears no one has been successful to run CGI 
> mapserver in its CGI-bin folder. Am i right?


You are not right. MapServer is surprisingly easy to set up and get working, at 
least for basic and mid-complexity use cases.


> CGI mapserver is useful just when shell access is available? Should i switch 
> to Mapscript? Or maybe, buy a windows host with CGI capability?


Unless you figure out what you are doing wrong, you can't set it right. Why 
don't you post your issues here in detail (how you are setting things up, have 
you followed the tutorial, etc.) along with the errors you are getting (general 
description as well as specific error messages. I am sure one of us will be 
able to help you.



> 
> Your help would nicely be appreciated. I'm really got stuck and confused.
> 


Yup, frustration is a common feeling when things don't work, but really, no 
need to give up. "You can do it, we can help"



--
Puneet Kishor
Science and Data Policy at Creative Commons
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Mapserver useful for ordinary sites or not?

2012-12-05 Thread Mr. Puneet Kishor

On Dec 5, 2012, at 10:48 AM, Saka Royban  wrote:

> 
> 
> Hi Stephen
> It's CentOS and i've extracted that file from Enterprise Linux GIS.
> I ONLY have cPanel in front myself. How can i run that command?


If you don't have shell access, you can ask your web host to install it for 
you. Most decent web hosting providers will do it for you. If they don't, you 
should consider moving to one who will.



> 
> Sorry but i really don't know.
> 
> Thanks
> 
> - Original Message -
> From: Stephen Woodbridge 
> To: mapserver-users@lists.osgeo.org
> Cc: 
> Sent: Wednesday, December 5, 2012 10:01 PM
> Subject: Re: [mapserver-users] Mapserver useful for ordinary sites or not?
> 
> It is
> probably failing because of missing dependency.
> 
> Try this from the command line:
> 
> /path/to/cgi-bin/mapserver -v
> 
> This will give a more useful error message you can read.
> 
> That said, extracting the binary and copying it to the cgi-bin is not 
> going to work in most cases because the whole point of package systems 
> like rpm it to find and install the dependencies.
> 
> What version of linux is installed on your host?
> There is probably a one line command that we can give you to install 
> mapserver the correct way.
> 
> -Steve W
> 
> On 12/5/2012 1:16 PM, Saka Royban wrote:
>> Thanks for your answer
>> After lots of try, i found that i can extract mapserver binary from rpm
>> using 7zip. I put that executable file to cgi-bin and call it via
>> address bar but no success, just 500 Internal Server Error. (I know
>> mapserver has some dependencies but in spite of that it everything was
>> 
> right it should display a nice error)
>> Contacting with guys in host provider, they pointed me to
>> http://mapserver.org/installation/unix.html#installation and finally
>> told me there is no shell access to run this commands.
>> I'm familiar with structure of mapserver cause of working with MS4W in
>> my own computer. In addition, i've checked CGI-bin directory by running
>> some perl script and everything is O.K. They really provide CGI capability.
>> 
>> Now, i don't know what can i do more. (I'm not familiar with Linux,
>> although i know what running a shell command means. I've been around
>> computer since DOS age)
>> 
>> Thanks in advance for helpful advices.
>> Regards
>> 
>> 
>> - Original Message -
>> From: Mr. Puneet Kishor 
>> To: MapServer OSGEO 
>> Cc:
>> Sent: Wednesday, December 5, 2012 9:24 PM
>> Subject: Re: [mapserver-users] Mapserver useful for ordinary sites or not?
>> 
>> 
>> On Dec 5, 2012, at 9:40 AM, Saka Royban > <mailto:sakaroy...@yahoo.com>> wrote:
>> 
>>   > Hi guys
>>   > After a lot of effort to use CGI mapserver in my own site and finally
>> leaving hope to find a solution, i came here to ask whether maserver is
>> useful just for dedicated servers or VPSs really?
>>   > I
> (and as it sounds, most of users) have just bought some space from
>> a host provider (i.e Linux) with a CGI-bin directory which as my host
>> provider says is able to run CGI applications written in perl and C/C++.
>>   >
>>   > I have searched a lot but as it appears no one has been successful to
>> run CGI mapserver in its CGI-bin folder. Am i right?
>> 
>> 
>> You are not right. MapServer is surprisingly easy to set up and get
>> working, at least for basic and mid-complexity use cases.
>> 
>> 
>>   > CGI mapserver is useful just when shell access is available? Should i
>> switch to Mapscript? Or maybe, buy a windows host with CGI capability?
>> 
>> 
>> Unless you figure out what you are doing wrong, you can't set it right.
>> Why don't you post your issues here in detail (how you are setting
>> things up, have you followed the tutorial, etc.)
> along with the errors
>> you are getting (general description as well as specific error messages.
>> I am sure one of us will be able to help you.
>> 
>> 
>> 
>>   >
>>   > Your help would nicely be appreciated. I'm really got stuck and confused.
>>   >
>> 
>> 
>> Yup, frustration is a common feeling when things don't work, but really,
>> no need to give up. "You can do it, we can help"
>> 
>> 
>> 
>> --
>> Puneet Kishor
>> Science and Data Policy at Creative Commons

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Rendering Hindi Characters

2013-01-23 Thread Mr. Puneet Kishor

On Jan 23, 2013, at 12:17 PM, Stephen Woodbridge  
wrote:

> On 1/23/2013 2:20 PM, Peter Mallen wrote:
>> Hello Everyone,
>> 
>> I am having issues rendering certain Hindi characters. I am using UTF-8
>> encoding.
>> 
>> When attempting to display the following Hindi character in MapServer: र्ट
>> 
>> It is rendered in MapServer as the following two characters: र् ट
>> 
>> I believe these characters form what is called a conjunct consonant, of
>> which there appear to be thousands of and most of them do not render
>> using MapServer.
>> 
>> Also, It appears that MapServer is having an issue displaying these
>> conjunct consonants and wants to display these characters separately
>> rather than to form them as one combined character.
>> 
>> Here is a link describing more about the Devanagari alphabet:
>> http://www.omniglot.com/writing/devanagari.htm
>> 
>> Can anyone please help with this?
>> 
>> Thank You,
>> 
>> Peter Mallen
> 
> Hi Peter,
> 
> I can not speak to this specific problem but I can give you and overview. 
> Mapserver uses fribidi library for rending this data and I know from working 
> with Arabic that a lot depends on the font you are using, in additional to 
> the capabilities and version of fribidi library.



Isn't fribidi specifically for bidirectional languages? Hindi is strictly LTR.


> 
> This kind of question is probably best asked on the fribidi list as they will 
> know more about what is supported or not for any given language and they 
> might be able to point you to a better font.
> 
> http://www.fribidi.org/
> 
> You should probably make sure you are using a recent version of the library 
> like 0.19.2 or better and be aware the 0.19.5 was released in Dec 2012.
> 


Peter, I forget where you and I left our off-list conversation re. the issues 
you were having with rendering Devnagari. Did you try feeding MapServer the 
correct Unicode characters?

Hope you figure this out.


--
Puneet Kishor

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Rendering Hindi Characters

2013-01-23 Thread Mr. Puneet Kishor
(adding the list back to cc so brains better than mine may help)


On Jan 23, 2013, at 3:47 PM, "Peter Mallen"  wrote:

> Hi Puneet,
> 
> I have passed the codes you have provided into MapServer  (U+0930 U+094D 
> U+091F ) and it displays the characters separately, not as one character.
> 
> This is how Map Server displays it: र् ट



hmmm... well, then this is definitely above my pay grade. Seems like you are 
doing the right thing, but my guess is MapServer's Unicode implementation is 
not working properly.

I don't see any mention of Unicode on mapserver docs page. The only potentially 
relevant bit I see is  
(http://www.mapserver.org/installation/unix.html#obtaining-the-necessary-software)
 that libgd should be compiled against the iconv library which provides full 
support for Unicode. On my MBA I get

$ ~ > gdlib-config --libs
-lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng -lz -liconv



> 
> Thank You,
> 
> Peter Mallen
> -Original Message-
> From: Mr. Puneet Kishor [mailto:punk.k...@gmail.com] 
> Sent: Wednesday, January 23, 2013 3:36 PM
> To: Peter Mallen
> Subject: Re: [mapserver-users] Rendering Hindi Characters
> 
> 
> On Jan 23, 2013, at 3:00 PM, "Peter Mallen"  
> wrote:
> 
>> Hi Puneet,
>> 
>> I did try feeding MapServer the correct Unicode characters, and it did fix 
>> the characters using what I believe is called the "Reph" symbol (ि) but I 
>> could not get the conjunct consonants to display correctly.
> 
> 
> I have no idea what the above means ;-), but, did you try passing U+0930 
> U+094D U+091F to MapServer? See http://www.unicode.org/charts/PDF/U0900.pdf
> 
> 
> U+0930 -> र -> r
> U+094D ->  ् -> "halves" the previously typed r 091F -> ट -> thick t 
> U+sound
> 
> 
> 
>> 
>> Also, I have posted on the fribidi list and I believe it does only help with 
>> bidirectional languages, but I could be wrong.
>> 
>> Thank You,
>> 
>> Peter Mallen
>> 
>> -Original Message-
>> From: mapserver-users-boun...@lists.osgeo.org 
>> [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. 
>> Puneet Kishor
>> Sent: Wednesday, January 23, 2013 12:27 PM
>> To: mapserver-users@lists.osgeo.org
>> Subject: Re: [mapserver-users] Rendering Hindi Characters
>> 
>> 
>> On Jan 23, 2013, at 12:17 PM, Stephen Woodbridge  
>> wrote:
>> 
>>> On 1/23/2013 2:20 PM, Peter Mallen wrote:
>>>> Hello Everyone,
>>>> 
>>>> I am having issues rendering certain Hindi characters. I am using
>>>> UTF-8 encoding.
>>>> 
>>>> When attempting to display the following Hindi character in
>>>> MapServer: र्ट
>>>> 
>>>> It is rendered in MapServer as the following two characters: र् ट
>>>> 
>>>> I believe these characters form what is called a conjunct consonant, 
>>>> of which there appear to be thousands of and most of them do not 
>>>> render using MapServer.
>>>> 
>>>> Also, It appears that MapServer is having an issue displaying these 
>>>> conjunct consonants and wants to display these characters separately 
>>>> rather than to form them as one combined character.
>>>> 
>>>> Here is a link describing more about the Devanagari alphabet:
>>>> http://www.omniglot.com/writing/devanagari.htm
>>>> 
>>>> Can anyone please help with this?
>>>> 
>>>> Thank You,
>>>> 
>>>> Peter Mallen
>>> 
>>> Hi Peter,
>>> 
>>> I can not speak to this specific problem but I can give you and overview. 
>>> Mapserver uses fribidi library for rending this data and I know from 
>>> working with Arabic that a lot depends on the font you are using, in 
>>> additional to the capabilities and version of fribidi library.
>> 
>> 
>> 
>> Isn't fribidi specifically for bidirectional languages? Hindi is strictly 
>> LTR.
>> 
>> 
>>> 
>>> This kind of question is probably best asked on the fribidi list as they 
>>> will know more about what is supported or not for any given language and 
>>> they might be able to point you to a better font.
>>> 
>>> http://www.fribidi.org/
>>> 
>>> You should probably make sure you are using a recent version of the library 
>>> like 0.19.2 or better and be aware the 0.19.5 was released in Dec 2012.
>>> 
>> 
>> 
>> Peter, I forget where you and I left our off-list conversation re. the 
>> issues you were having with rendering Devnagari. Did you try feeding 
>> MapServer the correct Unicode characters?
>> 
>> Hope you figure this out.
>> 
>> 
>> --
>> Puneet Kishor
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Rendering Hindi Characters

2013-01-23 Thread Mr. Puneet Kishor
Peter,

My guru in all things Hindi fonts tells me that the problem lies at the level 
where encodings are converted into font renderings. Apparently, र् ट is a 
perfectly correct alternate rendering of the unicode, just not Correct (with a 
capital C). I have no idea where this happens with MapServer. Thankfully I've 
never had to create a map with Hindi labels (I would be curious to learn, 
perhaps off-list, who wants to see maps with Hindi labels), but I too would 
like to see this resolved.

Hope someone knowledgable chimes in.


On Jan 23, 2013, at 3:58 PM, "Mr. Puneet Kishor"  wrote:

> (adding the list back to cc so brains better than mine may help)
> 
> 
> On Jan 23, 2013, at 3:47 PM, "Peter Mallen"  
> wrote:
> 
>> Hi Puneet,
>> 
>> I have passed the codes you have provided into MapServer  (U+0930 U+094D 
>> U+091F ) and it displays the characters separately, not as one character.
>> 
>> This is how Map Server displays it: र् ट
> 
> 
> 
> hmmm... well, then this is definitely above my pay grade. Seems like you are 
> doing the right thing, but my guess is MapServer's Unicode implementation is 
> not working properly.
> 
> I don't see any mention of Unicode on mapserver docs page. The only 
> potentially relevant bit I see is  
> (http://www.mapserver.org/installation/unix.html#obtaining-the-necessary-software)
>  that libgd should be compiled against the iconv library which provides full 
> support for Unicode. On my MBA I get
> 
>$ ~ > gdlib-config --libs
>-lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng -lz -liconv
> 
> 
> 
>> 
>> Thank You,
>> 
>> Peter Mallen
>> -Original Message-
>> From: Mr. Puneet Kishor [mailto:punk.k...@gmail.com] 
>> Sent: Wednesday, January 23, 2013 3:36 PM
>> To: Peter Mallen
>> Subject: Re: [mapserver-users] Rendering Hindi Characters
>> 
>> 
>> On Jan 23, 2013, at 3:00 PM, "Peter Mallen"  
>> wrote:
>> 
>>> Hi Puneet,
>>> 
>>> I did try feeding MapServer the correct Unicode characters, and it did fix 
>>> the characters using what I believe is called the "Reph" symbol (ि) but I 
>>> could not get the conjunct consonants to display correctly.
>> 
>> 
>> I have no idea what the above means ;-), but, did you try passing U+0930 
>> U+094D U+091F to MapServer? See http://www.unicode.org/charts/PDF/U0900.pdf
>> 
>> 
>> U+0930 -> र -> r
>> U+094D ->  ् -> "halves" the previously typed r 091F -> ट -> thick t 
>> U+sound
>> 
>> 
>> 
>>> 
>>> Also, I have posted on the fribidi list and I believe it does only help 
>>> with bidirectional languages, but I could be wrong.
>>> 
>>> Thank You,
>>> 
>>> Peter Mallen
>>> 
>>> -Original Message-
>>> From: mapserver-users-boun...@lists.osgeo.org 
>>> [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. 
>>> Puneet Kishor
>>> Sent: Wednesday, January 23, 2013 12:27 PM
>>> To: mapserver-users@lists.osgeo.org
>>> Subject: Re: [mapserver-users] Rendering Hindi Characters
>>> 
>>> 
>>> On Jan 23, 2013, at 12:17 PM, Stephen Woodbridge  
>>> wrote:
>>> 
>>>> On 1/23/2013 2:20 PM, Peter Mallen wrote:
>>>>> Hello Everyone,
>>>>> 
>>>>> I am having issues rendering certain Hindi characters. I am using
>>>>> UTF-8 encoding.
>>>>> 
>>>>> When attempting to display the following Hindi character in
>>>>> MapServer: र्ट
>>>>> 
>>>>> It is rendered in MapServer as the following two characters: र् ट
>>>>> 
>>>>> I believe these characters form what is called a conjunct consonant, 
>>>>> of which there appear to be thousands of and most of them do not 
>>>>> render using MapServer.
>>>>> 
>>>>> Also, It appears that MapServer is having an issue displaying these 
>>>>> conjunct consonants and wants to display these characters separately 
>>>>> rather than to form them as one combined character.
>>>>> 
>>>>> Here is a link describing more about the Devanagari alphabet:
>>>>> http://www.omniglot.com/writing/devanagari.htm
>>>>> 
>>>>> Can anyone please help with this?
>>>>> 
>>>>> Thank You,
>>>>> 
>>>>> Peter Mallen
>>>> 
>>>> Hi Pete

Re: [mapserver-users] Combined spatial and attribute query

2013-02-08 Thread Mr. Puneet Kishor

On Feb 8, 2013, at 8:01 AM, "Bistrais, Bob"  wrote:

> Does anyone have advice on the best or most efficient way to query data, 
> involving both a spatial and an attribute query.  I need to query several 
> layers, selecting based on an area, then select from that selection based on 
> an attribute value.  It would be OK to query by the attribute first, then 
> spatial.


This is a very generic, broad question that would have very specific 
case-by-case answers. It all depends on your query and, more importantly, your 
indexes.

Why don't you just time both strategies and then figure out which one you could 
tune further. Depending on the attributes, you could possibly have more 
latitude playing around with the various indexes instead of just the spatial 
index.


--
Puneet Kishor
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] mapserver-users Digest, Vol 65, Issue 54

2013-06-28 Thread Mr. Puneet Kishor
Dear MapServer admin,

Could you please drop the responder's email from the mailing list temporarily, 
until the responder returns on Aug 5?

Many thanks,


On Jun 28, 2013, at 8:43 AM, s...@planyukon.ca wrote:

> Sorry I missed you, but I am on parental leave/holiday/training until August 
> 5th. Urgent YLUPC business can be sent to the YLUPC director at 
> r...@planyukon.ca. 
> 
> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Error on mapserver

2013-07-10 Thread Mr. Puneet Kishor

On Jul 10, 2013, at 7:15 AM, "ciska...@tiscali.it"  wrote:

> Warning:  ms_newMapObj(): [MapServer Error]: msLoadMap(): First token 
> must be MAP, this doesn't look like a mapfile.\n in 


http://www.mapserver.org/introduction.html#introduction


--
Puneet Kishor
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Best way to do a batch reprojection (on windows)

2013-08-07 Thread Mr. Puneet Kishor

On Aug 7, 2013, at 2:47 PM, Mark Korver  wrote:

> If you are serving to
> many, and are not doing cached tiled requests, 



On a tangential note, tiling is so trivially easy that you should always be 
tiling. TileCache takes about 10 mins to set up, and is worth every one of 
those 10 mins.



--
Puneet Kishor
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: VS: [mapserver-users] Mapserver search performance

2011-05-03 Thread Mr. Puneet Kishor

On May 3, 2011, at 3:36 PM, Varun saraf wrote:

> Hi Puneet,
> 
> Thanks a lot for the prompt reply. I tried using Excel 2007 and was
> not able to re-save the dbf file after editing. Also, I am having DBF
> files with about a million records and Excel tends to hang for these
> operations.


Now you tell us ;-). My sense is that most gui-based tools will choke on 
million+ rows. You might well want to "upgrade" to a Pg/PostGIS solution at 
some point, but I realize that is not what you are asking for... (also, I 
believe the most recent Excel versions might have lost the DBF translation 
capabilities -- I am not an Excel person, so I can't confirm... besides, I use 
Macs, and Excel is most likely hobbled on Macs anyway).


> Is there some tool other than Excel which can do these
> operations?


I remember using Perl and XBase.pm to do this. It was really very quick and 
trivial, but it was a long time ago. Choose your language of choice. Try R.




> 
> Thanks,
> Varun
> 
> On Tue, May 3, 2011 at 4:27 PM, Mr. Puneet Kishor  wrote:
>> 
>> On May 3, 2011, at 3:19 PM, Varun saraf wrote:
>> 
>>> ..Is there a DBF editor out
>>> there that can be used to import the fields from any external data
>>> source into the shapefile attribute DBF without affecting the
>>> structure? I looked for a lot but they do not have the capability of
>>> doing a JOIN based on a common field and pulling data into the
>>> shapefile DBF automatically.
>> 
>> Just use MS-Excel or any program that can open up and write DBF. As long as 
>> you are careful to not change the number of rows, just add additional 
>> columns, and make sure the column names are not changed, and follow the 
>> various DBF limitations, you should be ok. Make sure to keep a backup of the 
>> original DBF in case things go ka-pow!
>> 
>> Since the DBF data and the geometry are in separate files, there is no issue 
>> with adding more attributes provide you follow the care noted above.
>> ..
>> 
>> 
>> 
>> Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Visualizing the MapServer 6.0 release..

2011-05-16 Thread Mr. Puneet Kishor

On May 16, 2011, at 1:45 PM, Jeff McKenna wrote:

> Watch the changes to MapServer from the year 2000 all the way up to the 6.0 
> release! http://vimeo.com/gatewaygeomatics/mapserver6-0



Dunno what it means, but looks awesome.


> 
> (created with Gource & ffmpeg through the SVN logs)
> 
> -jeff
> 
> 
> 
> -- 
> Jeff McKenna
> MapServer Consulting and Training Services
> http://www.gatewaygeomatics.com/
> 
> 
> 
> 
> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] color standards in layers

2011-06-23 Thread Mr. Puneet Kishor


> On 6/23/2011 6:27 PM, Paul Alarcon wrote:
>> Hello evryone i'm a mapserver user, i love the way i work, but i have a
>> question i'm not a GIS Specialyst, but i want to know if there is color
>> ruler for the representation of the layers,because i want to follow the
>> goegraphic rules, some information about it i really apreciate.
> 

try colorbrewer.org



--
Puneet Kishor http://punkish.org
Research http://carbonmodel.org
Science Fellow http://creativecommons.org

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] creating a dynamic thematic map based on attribs in a Pg table

2011-08-24 Thread Mr. Puneet Kishor
I need a tute (or a pointer to one online) on how to color polys in a thematic 
map based on values retrieved from a separate table. I have

table a
---
gid
attrib_id
the_geom

table b
---
attrib_id
attrib_name
color_rgb (values such as "242 242 33" and "255 255 0")

I would like to have MS color the polys and name the layers, ideally without 
having to create the CLASS definitions for each of the 80+ attribs, something 
akin to

LAYER
NAME "my layer"
STATUS ON
TYPE POLYGON
CONNECTIONTYPE POSTGIS
..
DATA "the_geom FROM (SELECT gid, the_geom, attrib_name, color_rgb FROM 
a JOIN b ON a.attrib_id = b.attrib_id) view USING UNIQUE gid"

CLASS
NAME   [attrib_name]
STYLE
COLOR[color_rgb]
OUTLINECOLOR 0 0 0
END
END
END

How do I accomplish something like 
above?___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: creating a dynamic thematic map based on attribs in a Pg table

2011-08-24 Thread Mr. Puneet Kishor
Please see the end of the email for a variation on this problem --


On Aug 24, 2011, at 11:14 AM, Mr. Puneet Kishor wrote:

> I need a tute (or a pointer to one online) on how to color polys in a 
> thematic map based on values retrieved from a separate table. I have
> 
> table a
> ---
> gid
> attrib_id
> the_geom
> 
> table b
> ---
> attrib_id
> attrib_name
> color_rgb (values such as "242 242 33" and "255 255 0")
> 
> I would like to have MS color the polys and name the layers, ideally without 
> having to create the CLASS definitions for each of the 80+ attribs, something 
> akin to
> 
>LAYER
>NAME "my layer"
>STATUS ON
>TYPE POLYGON
>CONNECTIONTYPE POSTGIS
>..
>DATA "the_geom FROM (SELECT gid, the_geom, attrib_name, color_rgb FROM 
> a JOIN b ON a.attrib_id = b.attrib_id) view USING UNIQUE gid"
> 
>CLASS
>NAME   [attrib_name]
>STYLE
>COLOR[color_rgb]
>OUTLINECOLOR 0 0 0
>END
>END
>END
> 
> How do I accomplish something like above?


Instead of getting the attrib name and color from the database, I want to get 
them from a remote web service. Could something like this be accomplished via 
SLDs? That is, MapServer requests an SLD from a remote server that tells it how 
to color each of the classes in the layer.

Many tia.

--
Puneet Kishor ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] dynamic layer classification

2011-08-26 Thread Mr. Puneet Kishor
hola,

I need some guidance on this (and my MapServer foo is severely rusted). My 
immediate need is to color a polygon layer (held in PostGIS) based on an 
attribute in a separate table. The number of CLASSes is considerable, more than 
80 or so. This leads to a longer term need --

The coloring of these polys is a crucial and universal need in my field of 
work, and it horrendously complicated determining the correct color, and the 
calculations for the appropriate color keep on changing from time to time. In 
other words, many different applications need this ability to classify polys 
based on certain attributes. So, I am creating a web app that does nothing but 
tell what color to use -- you give it a set of attributes, and the web app 
replies with the color. It would be a RESTful app, sending the color 
information back as JSON. How could I use this information with MapServer?

In an ideal scenario, MapServer would query the data source, then, for each 
class in the layer, it would send a query to this color app, and the color app 
would tell MapServer what color to use to render the poly. The same app would 
be used by other apps, be they MapServer, OL, Polymaps, or even non-mapping 
apps such as R, etc.

Suggestions on how to proceed?

--
Puneet Kishor 
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] dynamic layer classification

2011-08-26 Thread Mr. Puneet Kishor

On Aug 26, 2011, at 12:39 PM, Brent Fraser wrote:

> Puneet,
> 
>  I think currently the short answer is Mapscript.
> 
>  I had a similar need last year 
> (http://lists.osgeo.org/pipermail/mapserver-users/2010-March/065050.html) 
> where I needed to have the symbology stored in the database and the classes 
> varied over  time (users created new class defs in the database via a web 
> page).
> 
>  Steve Lime suggested an enahancement where classes were defined by a SLD 
> file or url:
> 
> LAYER
>  NAME 'extreme-symbology'
>  DATA ...
>  CONNECTION ...
>  SLD 'some flle' or 'some url'
>  ...
> END
> 
> which is an elegant solution, but currently not implemented...


Yes, that would be a very nice solution, precisely the kind of thing I am 
looking for. In fact, even better would be

LAYER
 ..
 SLD 'some expression'

where 'some expression' could be stored in a file, or retrieve via a URL, or 
from a db query.

But, until that comes along, I could and will use MapScript. I compiled MS 
6.0.1 yesterday, and discovered, much to my delight, that MapScript in my 
favorite programming language (the one that begins with P) is alive and doing 
well.

So, how would I go about implementing this in MapScript? I would have to create 
the layer definition on the fly, no? Any pointers?



> 
> Best Regards,
> Brent Fraser
> 
> 
> On 8/26/2011 8:35 AM, Mr. Puneet Kishor wrote:
>> hola,
>> 
>> I need some guidance on this (and my MapServer foo is severely rusted). My 
>> immediate need is to color a polygon layer (held in PostGIS) based on an 
>> attribute in a separate table. The number of CLASSes is considerable, more 
>> than 80 or so. This leads to a longer term need --
>> 
>> The coloring of these polys is a crucial and universal need in my field of 
>> work, and it horrendously complicated determining the correct color, and the 
>> calculations for the appropriate color keep on changing from time to time. 
>> In other words, many different applications need this ability to classify 
>> polys based on certain attributes. So, I am creating a web app that does 
>> nothing but tell what color to use -- you give it a set of attributes, and 
>> the web app replies with the color. It would be a RESTful app, sending the 
>> color information back as JSON. How could I use this information with 
>> MapServer?
>> 
>> In an ideal scenario, MapServer would query the data source, then, for each 
>> class in the layer, it would send a query to this color app, and the color 
>> app would tell MapServer what color to use to render the poly. The same app 
>> would be used by other apps, be they MapServer, OL, Polymaps, or even 
>> non-mapping apps such as R, etc.
>> 
>> Suggestions on how to proceed?
>> 
>> --
>> Puneet Kishor
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] baby steps with MapScript (problem)

2011-08-27 Thread Mr. Puneet Kishor
I am relearning MapScript after years of innocence. I have a fairly simple 
script like so (also at http://pastebin.com/7rehitjH). The image is created, 
but is empty, plain white. There is some silliness on my part, something 
obvious I am overlooking or doing wrong, and I need someone to point it to me. 
Needless to say, the same map draws fine via MapServer CGI --

my $map = new mapscript::mapObj();
warn "New mapObj() error: $mapscript::ms_error->{message}\n" unless $map;

$map->{status} = $mapscript::MS_ON; # STATUS ON
$map->{units} = $mapscript::MS_DD;  # UNITS DD
$map->setImageType('png');  # IMAGETYPE PNG
$map->{imagecolor} = new mapscript::colorObj(255, 255, 255);# IMAGECOLOR 
255 255 255
$map->setSize(1000, 600);   # SIZE 1000 600
$map->setExtent( -180, -90, 180, 90 );  # EXTENT -180 
-90 180 90
$map->selectOutputFormat( 'png' );  # Choose active 
output format
$map->setProjection( "proj=latlong" );  # PROJECTION
#   
"proj=latlong"
# END

my $outputFormatObj = new mapscript::outputFormatObj('GD/PNG'); # DRIVER 
"GD/PNG"
$outputFormatObj->setExtension('png');  # EXTENSION 
"png"
$outputFormatObj->setMimetype('image/png'); # MIMETYPE 
"image/png"
$outputFormatObj->{imagemode} = $mapscript::MS_IMAGEMODE_RGB;   # IMAGEMODE RGB 
| PC256

$map->setOutputFormat( $outputFormatObj );

my $layerObj = new mapscript::layerObj($map);
$layerObj->setConnectionType($mapscript::MS_POSTGIS, '');
$layerObj->{connection} = "host=127.0.0.1 port=5432 dbname=$db user=$dbuser 
password=$pwd";
$layerObj->{data} = 'the_geom FROM table USING UNIQUE gid';

my $classObj = new mapscript::classObj($layerObj);
$classObj->{name} = 'foo';

my $styleObj = new mapscript::styleObj($classObj);
$styleObj->{color} = new mapscript::colorObj( 132, 132, 132);
$styleObj->{outlinecolor} = new mapscript::colorObj(0, 0, 0);
 
# create an image for drawing.
my $img = $map->draw();
warn "prepareImage() error: $mapscript::ms_error->{message}\n" unless $img;

$img->save("$tmp_dir/$image_name");___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: baby steps with MapScript (problem)

2011-08-27 Thread Mr . Puneet Kishor
Never mind... figured out the error, and its working now,


On Aug 27, 2011, at 5:02 PM, Mr. Puneet Kishor wrote:

> I am relearning MapScript after years of innocence. I have a fairly simple 
> script like so (also at http://pastebin.com/7rehitjH). The image is created, 
> but is empty, plain white. There is some silliness on my part, something 
> obvious I am overlooking or doing wrong, and I need someone to point it to 
> me. Needless to say, the same map draws fine via MapServer CGI --
> 
> my $map = new mapscript::mapObj();
> warn "New mapObj() error: $mapscript::ms_error->{message}\n" unless $map;
> 
> $map->{status} = $mapscript::MS_ON; # STATUS ON
> $map->{units} = $mapscript::MS_DD;  # UNITS DD
> $map->setImageType('png');  # IMAGETYPE 
> PNG
> $map->{imagecolor} = new mapscript::colorObj(255, 255, 255);# IMAGECOLOR 
> 255 255 255
> $map->setSize(1000, 600);   # SIZE 1000 
> 600
> $map->setExtent( -180, -90, 180, 90 );  # EXTENT -180 
> -90 180 90
> $map->selectOutputFormat( 'png' );  # Choose 
> active output format
> $map->setProjection( "proj=latlong" );  # PROJECTION
>#   
> "proj=latlong"
># END
> 
> my $outputFormatObj = new mapscript::outputFormatObj('GD/PNG'); # DRIVER 
> "GD/PNG"
> $outputFormatObj->setExtension('png');  # EXTENSION 
> "png"
> $outputFormatObj->setMimetype('image/png'); # MIMETYPE 
> "image/png"
> $outputFormatObj->{imagemode} = $mapscript::MS_IMAGEMODE_RGB;   # IMAGEMODE 
> RGB | PC256
> 
> $map->setOutputFormat( $outputFormatObj );
> 
> my $layerObj = new mapscript::layerObj($map);
> $layerObj->setConnectionType($mapscript::MS_POSTGIS, '');
> $layerObj->{connection} = "host=127.0.0.1 port=5432 dbname=$db user=$dbuser 
> password=$pwd";
> $layerObj->{data} = 'the_geom FROM table USING UNIQUE gid';
> 
> my $classObj = new mapscript::classObj($layerObj);
> $classObj->{name} = 'foo';
> 
> my $styleObj = new mapscript::styleObj($classObj);
> $styleObj->{color} = new mapscript::colorObj( 132, 132, 132);
> $styleObj->{outlinecolor} = new mapscript::colorObj(0, 0, 0);
> 
> # create an image for drawing.
> my $img = $map->draw();
> warn "prepareImage() error: $mapscript::ms_error->{message}\n" unless $img;
> 
> $img->save("$tmp_dir/$image_name");

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] layer classification with MapScript

2011-08-27 Thread Mr. Puneet Kishor
I have a layer classification issue. I want to do something along the lines of 
(semi-pseudocode ahead) --

$layerObj->{data} = 'the_geom FROM (SELECT gid, the_geom, class_name, 
class_color FROM table) t USING UNIQUE gid';
$layerObj->{classitem} = 'class_name';

while (my $row in $layerObj->{data}) {
create class with 'name = class_name', 'expression = class_name', 
'color = class_color'
}

How do I iterate over the rows retrieved from the table in order to create 
classes? I don't see any obvious reference to a db result 
set.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] layer classification with MapScript

2011-08-28 Thread Mr. Puneet Kishor

On Aug 28, 2011, at 8:11 AM, Cristiano Sumariva wrote:

> You can do database stuff using your programming language to access the
> database.
> 
> To create classes there is the msNewClassObj function to append a class to
> an layer reference.
> You can get function details in documentation page at
> http://mapserver.org/mapscript/php/index.html#classes.
> 
> If you want walk over records from the data statement declared on the data
> field, maybe using the getShape(  ), getNumResults() method on your layer
> reference may do what you want. But I do not have practice using it.
> 
> for ( loop = 0; loop < layer->getNumResults(); loop + 1 )
> dbRowFromDataField = layer->getResult( loop );
> class = msnewclass( layer );
> class->set( name, dbRowFromDataField.field );
> ...


The above seems logical, but I think it might have to do with the results from 
a "click" query rather than the data retrieved by MS from the data source in 
the first place. In any case, the following doesn't do anything at all (empty, 
white image) --

for ( 0 .. $layerObj->getNumResults() - 1) {
my $row = $layerObj->getResult( $_ );
my $classObj = new mapscript::classObj( $layerObj );
$classObj->{name} = $row->{interval_name};
my $styleObj = new map script::styleObj( $classObj );
    set style color based on $row->{class_color};
}

> 
> 
> 2011/8/27 Mr. Puneet Kishor 
> 
>> I have a layer classification issue. I want to do something along the lines
>> of (semi-pseudocode ahead) --
>> 
>>   $layerObj->{data} = 'the_geom FROM (SELECT gid, the_geom, class_name,
>> class_color FROM table) t USING UNIQUE gid';
>>   $layerObj->{classitem} = 'class_name';
>> 
>>   while (my $row in $layerObj->{data}) {
>>   create class with 'name = class_name', 'expression = class_name',
>> 'color = class_color'
>>   }
>> 
>> How do I iterate over the rows retrieved from the table in order to create
>> classes? I don't see any obvious reference to a db result
>> set.___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] layer classification with MapScript

2011-08-28 Thread Mr. Puneet Kishor

On Aug 28, 2011, at 1:27 PM, Mr. Puneet Kishor wrote:

> 
> On Aug 28, 2011, at 8:11 AM, Cristiano Sumariva wrote:
> 
>> You can do database stuff using your programming language to access the
>> database.
>> 
>> To create classes there is the msNewClassObj function to append a class to
>> an layer reference.
>> You can get function details in documentation page at
>> http://mapserver.org/mapscript/php/index.html#classes.
>> 
>> If you want walk over records from the data statement declared on the data
>> field, maybe using the getShape(  ), getNumResults() method on your layer
>> reference may do what you want. But I do not have practice using it.
>> 
>> for ( loop = 0; loop < layer->getNumResults(); loop + 1 )
>> dbRowFromDataField = layer->getResult( loop );
>> class = msnewclass( layer );
>> class->set( name, dbRowFromDataField.field );
>> ...
> 
> 
> The above seems logical, but I think it might have to do with the results 
> from a "click" query rather than the data retrieved by MS from the data 
> source in the first place. In any case, the following doesn't do anything at 
> all (empty, white image) --
> 
>for ( 0 .. $layerObj->getNumResults() - 1) {
>my $row = $layerObj->getResult( $_ );
>my $classObj = new mapscript::classObj( $layerObj );
>$classObj->{name} = $row->{interval_name};
>my $styleObj = new map script::styleObj( $classObj );
>   set style color based on $row->{class_color};
>}
> 
>> 
>> 


Heh, the above code was ridiculous on my part... it would try to create a new 
class for every single feature. Instead, the following works just fine


my $dbh = DBI->connect( .. );
my $sth = $dbh->prepare("SELECT class_name, class_color FROM color_table");
$sth->execute;
while (my ($class_name, $class_color) = $sth->fetchrow_array) {
my $classObj = new mapscript::classObj( $layerObj );
$classObj->{name} = $class_name;
$classObj->setExpression( $class_name );
my $styleObj = styleObj(classObj => $classObj, colorObj => 
colorObj('hex' => $class_color));
}


I get all the classes made correctly without having to code them individually.

The only minor downside, I have to make two different db calls -- one for 
MapServer, to get all the features, and one for the color information.

Now, on to the next step -- retrieve these color values via a REST API, which 
is really my original aim.



>> 2011/8/27 Mr. Puneet Kishor 
>> 
>>> I have a layer classification issue. I want to do something along the lines
>>> of (semi-pseudocode ahead) --
>>> 
>>>  $layerObj->{data} = 'the_geom FROM (SELECT gid, the_geom, class_name,
>>> class_color FROM table) t USING UNIQUE gid';
>>>  $layerObj->{classitem} = 'class_name';
>>> 
>>>  while (my $row in $layerObj->{data}) {
>>>  create class with 'name = class_name', 'expression = class_name',
>>> 'color = class_color'
>>>  }
>>> 
>>> How do I iterate over the rows retrieved from the table in order to create
>>> classes? I don't see any obvious reference to a db result
>>> set.___
>>> maps
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] layer classification with MapScript

2011-08-28 Thread Mr. Puneet Kishor
Hi Brent,

Thanks for the hand-holding. I got the solution for this first part of the 
challenge using MapScript; no Mapfile required at all. I will write up a more 
generalized article on this for the docs/wiki.


On Aug 28, 2011, at 10:19 AM, Brent Fraser wrote:

> Puneet,
> 
>  If you don't care about mapserver generating a legend graphic, you could use 
> mapserver CGI's ability (no scripting required) to do attribute binding (get 
> values from a feature's attribute values).  I've used a single class def of:
> 
>CLASS
>STYLE  # Line, Poly and Point outline
>SYMBOL   [sSymbol]
>OUTLINECOLOR [sOutlineColor]
>COLOR[sColor]
>SIZE [sSize]
>END
>TEXT ([Label])
>LABEL
>ANGLE AUTO
>POSITION UR
>COLOR [lColor]
>OUTLINECOLOR [lOutlineColor]
>TYPE truetype
>FONT 'Arial'
>SIZE [lSize]
>END
>END
> 
> where the data/connection accessed a view joining the feature table to a 
> class table where the styling values were defined.  And you need 3 layer 
> defs, one for points, lines and polygons.   But using this technique, there 
> is no way to get a legend graphic show all the classes.
> 
>  So in your PHP code you would need to do a  generic database query to get a 
> set of classes, then for each row create a class object and add it to the 
> layer object.  Then have mapscript process the features and render a map 
> image by doing a draw() (and a legend graphic by doing a drawLegend()).  Or, 
> as others have suggested,  you could pass an SLD to mapserver via WMS and 
> request a legend graphic.
> 
> Best Regards,
> Brent Fraser
> 
> 
> On 8/27/2011 5:02 PM, Mr. Puneet Kishor wrote:
>> I have a layer classification issue. I want to do something along the lines 
>> of (semi-pseudocode ahead) --
>> 
>> $layerObj->{data} = 'the_geom FROM (SELECT gid, the_geom, class_name, 
>> class_color FROM table) t USING UNIQUE gid';
>> $layerObj->{classitem} = 'class_name';
>> 
>> while (my $row in $layerObj->{data}) {
>> create class with 'name = class_name', 'expression = class_name', 
>> 'color = class_color'
>> }
>> 
>> How do I iterate over the rows retrieved from the table in order to create 
>> classes? I don't see any obvious reference to a db result 
>> set.___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] zoom out factor as int

2011-08-29 Thread Mr. Puneet Kishor
how do I express a zoom out factor in

zoomPoint( int zoomfactor, pointObj imgpoint, int width, int height, rectObj 
extent, rectObj maxextent ) : int


Obviously, 0.5 won't work as an int is expected.


--
Puneet Kishor ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] zoom out factor as int

2011-08-30 Thread Mr. Puneet Kishor

On Aug 30, 2011, at 9:16 AM, Carlos Ruiz wrote:

> Puneet,
> 
> You have to handle negative integers. For example, to zoom in x2 you have to 
> use +2, to zoom out you have to use -2.


Indeed I do... wouldn't have thought this up without your help. Many thanks 
Carlos.


> 
> Cheers from México
> 
> 
> IC Carlos Ruiz
> 
> 
> 
> ----- Original Message -
> From: Mr. Puneet Kishor 
> To: MapServer 
> Cc: 
> Sent: Monday, August 29, 2011 9:49 PM
> Subject: [mapserver-users] zoom out factor as int
> 
> how do I express a zoom out factor in
> 
> zoomPoint( int zoomfactor, pointObj imgpoint, int width, int height, rectObj 
> extent, rectObj maxextent ) : int
> 
> 
> Obviously, 0.5 won't work as an int is expected.
> 
> 
> --
> Puneet Kishor
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: Invalid SRS given: SRS must be valid for all requested layers. EPSG 23030

2011-08-30 Thread Mr. Puneet Kishor

On Aug 30, 2011, at 11:21 AM, Amalia Carolina Canavire wrote:

> hi ,I don't good speak english, but i don't understand you, when you say
> "Projection must be in meters which seem to be the unit for the EPSG:23030
> units", you can specify in where may correction in this code, please. thank
> for you time and helping.


Your declared projection "EPSG:23030" uses meters, but your extent `EXTENT 
-82.658149 29.4353788 -82.05008 29.943614` is definitely not in 
meters (unless, you are plotting a very tiny and strange area of the world that 
is only a few centimeters wide and long). Make sure your extent and projection 
units match.


> 
> 2011/8/30 Rahkonen Jukka 
> 
>> Hi,
>> 
>> I do not understand Spanish but it looks like you have something wrong with
>> projections.
>> 
>> MAP
>> EXTENT -82.658149 29.4353788 -82.05008 29.943614
>> PROJECTION
>> "init=epsg:23030"
>>  END
>> 
>> Projection must be in meters which seem to be the unit for the EPSG:23030
>> units
>> 
>> http://www.epsg-registry.org/report.htm?type=selection&entity=urn:ogc:def:crs:EPSG::23030&reportDetail=short&style=urn:uuid:report-style:default-with-code&style_name=OGP%20Default%20With%20Code&title=
>> 
>> The same with "wms_extent" "-82.658149 29.4353788 -82.05008
>> 29.943614"
>> use extents in the EPSG:23030 system and units.
>> 
>> -Jukka Rahkonen-
>> 
>> 
>> 
>> Lähettäjä: mapserver-users-boun...@lists.osgeo.org [
>> mapserver-users-boun...@lists.osgeo.org] käyttäjän Amalia Carolina
>> Canavire [acarolin...@gmail.com] puolesta
>> Lähetetty: 30. elokuuta 2011 16:55
>> Vastaanottaja: Lista de Usuarios de gvSIG; mapserver-users@lists.osgeo.org
>> Aihe: [mapserver-users] msWMSLoadGetMapParams(): WMS server error. Invalid
>> SRS given: SRS must be valid for all requested layers. EPSG 23030
>> 
>> Hola gente, una duda  usando gvsig para poder generar una vista desde un
>> .shp debo seleccionar una proyección epsg 23030, porque no me reconece epsg
>> 4326 (con esta opción mi vista es vacia , a que se debe?
>> Estoy usando gvsig 1.1 por la extensión de publicación, sobre ubuntu.
>> Debido a ello , por las dudas, respeto esta proyección epsg 23030, cuando
>> utilizo  vista desde wms, me muestra sin problema, ahora cuando lo hago para
>> web, me sale el error de :
>> msWMSLoadGetMapParams(): WMS server error. Invalid SRS given: SRS must be
>> valid for all requested layers .
>> 
>> Si cambio la proyeccion a 4326, no sale el error pero no me muestra nada.
>> Mi codigo es el sgte:
>> 
>> 
>> 
>> MAP
>>  NAME map_generated_by_gvsig
>>  SIZE 600 400
>>  EXTENT -82.658149 29.4353788 -82.05008 29.943614
>>  SYMBOLSET "dmwms1.sym"
>>  FONTSET "fonts.txt"
>>  LEGEND
>> IMAGECOLOR -1 -1 -1
>> LABEL
>>FONT "vera"
>>ANGLE FOLLOW
>>COLOR 0 0 0
>>ENCODING "UTF-8"
>>TYPE truetype
>>SIZE 8
>> END
>> STATUS ON
>> TRANSPARENT ON
>>  END
>>  WEB
>> METADATA
>>"wms_encoding" "UTF-8"
>>"wms_title" "Mapserver WMS"
>>"wms_abstract" ""
>>"wms_srs" " EPSG:23030"
>>"wms_onlineresource" "
>> http://localhost/cgi-bin/mapserv?map=%2Fvar%2Fwww%2FgisParcelsFL%2Fmap%2Fdmwms1.map
>> "
>> END
>>  END
>>  PROJECTION
>> "init=epsg:23030"
>>  END
>>  LAYER
>> NAME "tl_2010_12001_roads.shp"
>> STATUS ON
>> TYPE LINE
>> DATA
>> "/var/www/gisParcelsFL/tl_2010_12001_roads/tl_2010_12001_roads.shp"
>> MAXSCALE -1.0
>> MINSCALE -1.0
>> TRANSPARENCY 100
>> SIZEUNITS pixels
>> LABELITEM "FULLNAME"
>> PROJECTION
>>"init=epsg:23030"
>> END
>> CLASS
>>STYLE
>>   COLOR 153 153 153
>>   WIDTH 1
>>END
>>NAME "default"
>>LABEL
>>   FONT "vera"
>>   ANGLE FOLLOW
>>   COLOR 0 0 0
>>   TYPE truetype
>>   SIZE 7.0
>>END
>> END
>> METADATA
>>"wms_title" "tl_2010_12001_roads.shp"
>>"wms_abstract" "generated by gvSIG"
>>"wms_extent" "-82.658149 29.4353788 -82.05008
>> 29.943614"
>>"gml_include_items" "all"
>> END
>>  END # Layer
>> END # Map File
>> 
>> --
>> 
>> **   :) sonrei que te queda lindo :):):):): amy cgc
>> **
>> 
>> 
> 
> 
> -- 
> 
> *** *  :) *sonrei que te queda lindo :):):):): **amy **cgc
> **
> *
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] questions re. MapScript

2011-09-03 Thread Mr. Puneet Kishor
for you MapScript mavens --


A few things have me puzzled about MapScript. I have the following code, and it 
works --

my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$dbhost;port=$dbport", 
$dbuser, $dbpswd);
my $msh = "host=$dbhost port=$dbport dbname=$dbname user=$dbuser 
password=$dbpswd";

my $map = new mapscript::mapObj();

my $classOutline = new mapscript::colorObj;
$classOutline->setHex('#44');

# Layer One
my $layer_one = new mapscript::layerObj($map);
$layer_one->{name} = 'Layer One';
$layer_one->{status} = $mapscript::MS_ON;
$layer_one->{type} = $mapscript::MS_LAYER_POLYGON;
$layer_one->setConnectionType($mapscript::MS_POSTGIS, '');
$layer_one->{connection} = $msh;
$layer_one->{data} = 'the_geom FROM (SELECT gid, class_name, the_geom FROM 
table1) foo USING UNIQUE gid';
$layer_one->setFilter('gid NOT IN (.. bunch of gids ..)');
$layer_one->{classitem} = 'class_name';

my $sth = $dbh->prepare("SELECT class_name, class_color FROM color_table");
$sth->execute;
while (my ($class_name, $class_color) = $sth->fetchrow_array) {
my $classObj = new mapscript::classObj( $layer_one );
$classObj->{name} = $class_name;
$classObj->setExpression( $class_name );

my $styleObj = new mapscript::styleObj($classObj);

my $classFill = new mapscript::colorObj;
$classFill->setHex($class_color);

$styleObj->{color} = $classFill;
$styleObj->{outlinecolor} = $classOutline;
}

Question 0: Is there are more efficient way to accomplish the above?

Question 1: I am assuming there is no way I can reuse the same db handle above, 
once for MapServer, and the other time to make my own queries. Neverthless, I 
would like to confirm.

Question 2: I tried to add a WHERE clause in the "data" value, but that caused 
error. I am assuming that is not allowed, but I would like to confirm.

Now, here is a really puzzling thing. If I add another layer, exactly after the 
above pattern, for example, see the code below, MapServer crashes with the 
message "prepareImage() error: Can't call method 'save on an undefined value."
Seems like there is an error somewhere, and $map gets all messsed up. 

# Layer Two
my $layer_two = new mapscript::layerObj($map);
$layer_two->{name} = 'Layer Two';
$layer_two->{status} = $mapscript::MS_ON;
$layer_two->{type} = $mapscript::MS_LAYER_POLYGON;
$layer_two->setConnectionType($mapscript::MS_POSTGIS, '');
$layer_two->{connection} = $msh;
$layer_two->{data} = 'the_geom FROM (SELECT gid, class_id, the_geom FROM 
table2) bar USING UNIQUE gid';
$layer_two->{classitem} = 'class_id';

$sth = $dbh->prepare("SELECT class_id, class_color FROM another_color_table");
$sth->execute;
while (my ($class_id, $class_color) = $sth->fetchrow_array) {
my $classObj = new mapscript::classObj( $layer_two );
$classObj->{name} = $class_name;
$classObj->setExpression( $class_name );

my $styleObj = new mapscript::styleObj($classObj);

my $classFill = new mapscript::colorObj;
$classFill->setHex($class_color);

$styleObj->{color} = $classFill;
$styleObj->{outlinecolor} = $classOutline;
}


How do I get MapServer to write out detailed error messages? 

There seems to be an `errorObj` that allows inspection of the MapServer error 
stack. "Only needed for the Perl module as the other language modules expose 
the error stack through exceptions." Alright, but there is no constructor for 
this object. How do I use this?


--
Puneet Kishor ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] why doesn't a view work in the data string?

2011-09-03 Thread Mr. Puneet Kishor
Another oddity about MapScript. I have the PostGIS functions and definitions 
installed in the public schema of my db. I have moved the data tables to 
different schema to keep things tidy. I modified the search_path like so

ALTER DATABASE mydb SET search_path = public, data1, data2;

The following works fine, which is strange because I would expect it to require 
the schema prefix (in spite of having modified the search_path, I require the 
prefix in other clients, such as pgAdmin3) --

$layer_one->{data} = 'the_geom FROM (SELECT gid, class_name, class_color, 
the_geom FROM table) a_view USING UNIQUE gid';
$layer_one->setFilter('gid NOT IN ( .. a bunch of gids .. )');

Yet, if I make a view with the above logic like so

CREATE VIEW data1.a_view AS
SELECT gid, class_name, class_color, the_geom 
FROM data1.table 
WHERE gid NOT IN ( .. a bunch of gids .. );

and use that to access the data with the following code, I get a crash 
"prepareImage() error: Can't call method 'save' on an undefined value"

$layer_one->{data} = 'the_geom FROM a_view USING UNIQUE did';


--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] questions re. MapScript

2011-09-03 Thread Mr. Puneet Kishor
Thanks Cristiano, for your replies. The most puzzling and show-stopping for me 
is that as soon as I add another layer, MapServer crashes. See the very end of 
my original post below.

On Sep 3, 2011, at 7:12 PM, Cristiano Sumariva wrote:

> Question 0: well I do not think it is too much overhead to set some
> variables in memory for the mapserver objects.
> But you can do all you need at the file with extension .map and only update
> what you need in the programming language.
> So you can call
> new mapObject = mapscript::map( 'path/file.map' );
> // load all your parameters that not change ( or do not change often ) //
> // update only the snippets you need //
> // need to set up first layer data to a sql assembled at runtime //
> // so only grab the reference to the layer you want set //
> layer = mapObject->getLayer( index /* start on zero */ )
> // and update only that property //
> layer->set( 'data', 'the_geom FROM ( SELECT att FROM table WHERE att OP
> 'value' ) AS  TableFromWhere USING UNIQUE att USING SRID  ).
> 
> You maybe doing something like a did in past. Creating all mapfile
> configuration at application using forms and storing it inside database
> schema.
> That is not much hard to create an manager to do that. You need a couple of
> tables on some schema/db and create some checks for mapserver enumerations.
> The most benefits of this strategy is to have a system that will be error
> free on mapfile syntax and have a very fast mapserver configuration for
> users that want create
> map collections from a shared pool of features.
> 
> Question 2 is on the sample above. You need to wrap the where at a sub query
> so mapserver can see it like a one entire new table.
> 
> Question 1: I not much sure but I guess you can not share database
> descriptors. If you having low speed due to database stuff you can try use a
> persistent
> connection for your script so you only open one for mapserver. I guess that
> mapserver can also use a shared database connection for him but do not
> remember a sample case for it.
> 
> Hope you enjoying your map rendering engine.
> 
> Most times low speed is due to databases not properly indexed.
> 
> 2011/9/3 Mr. Puneet Kishor 
> 
>> for you MapScript mavens --
>> 
>> 
>> A few things have me puzzled about MapScript. I have the following code,
>> and it works --
>> 
>> my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$dbhost;port=$dbport",
>> $dbuser, $dbpswd);
>> my $msh = "host=$dbhost port=$dbport dbname=$dbname user=$dbuser
>> password=$dbpswd";
>> 
>> my $map = new mapscript::mapObj();
>> 
>> my $classOutline = new mapscript::colorObj;
>> $classOutline->setHex('#44');
>> 
>> # Layer One
>> my $layer_one = new mapscript::layerObj($map);
>> $layer_one->{name} = 'Layer One';
>> $layer_one->{status} = $mapscript::MS_ON;
>> $layer_one->{type} = $mapscript::MS_LAYER_POLYGON;
>> $layer_one->setConnectionType($mapscript::MS_POSTGIS, '');
>> $layer_one->{connection} = $msh;
>> $layer_one->{data} = 'the_geom FROM (SELECT gid, class_name, the_geom FROM
>> table1) foo USING UNIQUE gid';
>> $layer_one->setFilter('gid NOT IN (.. bunch of gids ..)');
>> $layer_one->{classitem} = 'class_name';
>> 
>> my $sth = $dbh->prepare("SELECT class_name, class_color FROM color_table");
>> $sth->execute;
>> while (my ($class_name, $class_color) = $sth->fetchrow_array) {
>>   my $classObj = new mapscript::classObj( $layer_one );
>>   $classObj->{name} = $class_name;
>>   $classObj->setExpression( $class_name );
>> 
>>   my $styleObj = new mapscript::styleObj($classObj);
>> 
>>   my $classFill = new mapscript::colorObj;
>>   $classFill->setHex($class_color);
>> 
>>   $styleObj->{color} = $classFill;
>>   $styleObj->{outlinecolor} = $classOutline;
>> }
>> 
>> Question 0: Is there are more efficient way to accomplish the above?
>> 
>> Question 1: I am assuming there is no way I can reuse the same db handle
>> above,
>> once for MapServer, and the other time to make my own queries. Neverthless,
>> I
>> would like to confirm.
>> 
>> Question 2: I tried to add a WHERE clause in the "data" value, but that
>> caused
>> error. I am assuming that is not allowed, but I would like to confirm.
>> 
>> Now, here is a really puzzling thing. If I add another layer, exactly after
>> the
>> above p

[mapserver-users] could MapServer be closing connection to Pg prematurely?

2011-09-03 Thread Mr. Puneet Kishor
I have the following code

$layer_gmna->{name} = 'gmna';
$layer_gmna->{status} = $mapscript::MS_ON;
$layer_gmna->{type} = $mapscript::MS_LAYER_POLYGON;
$layer_gmna->{connection} = "host=$dbhost port=$dbport dbname=$dbname 
user=$dbuser password=$dbpswd";
$layer_gmna->setConnectionType($mapscript::MS_POSTGIS, '');
$layer_gmna->{data} = 'the_geom FROM ..';
$layer_gmna->{classitem} = 'interval_name';

my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$dbhost;port=$dbport", 
$dbuser, $dbpswd);
>>> my $sth = $dbh->prepare("SELECT interval_name, color_hex FROM 
>>> intervals_old");
$sth->execute or debug $sth->errstr;
while (my ($interval_name, $color_hex) = $sth->fetchrow_array) {
my $classObj = new mapscript::classObj( $layer_gmna );
$classObj->{name} = $interval_name;
$classObj->setExpression( $interval_name );
my $styleObj = styleObj(classObj => $classObj, colorObj => 
colorObj('hex' => $color_hex));
}


By the time I reach the line marked with '>>>', the db connection is closed. I 
get the following message: "DBD::Pg::st execute failed: server closed the 
connection unexpectedly. This probably means the server terminated abnormally 
before or while processing the request. at 
/Users/punkish/Documents/www/geomaps/lib/geomaps.pm line 1225."

Maybe MapServer has nothing to do with it, but, is it possible that MapServer 
efficiently closes all DB connections after it has pulled in the data from the 
tables? If so, is there a way I can stop it from doing 
so?___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: could MapServer be closing connection to Pg prematurely?

2011-09-03 Thread Mr . Puneet Kishor
the following is solved by adding ` {InactiveDestroy => 1}` to the $dbh


On Sep 3, 2011, at 9:19 PM, Mr. Puneet Kishor wrote:

> I have the following code
> 
>$layer_gmna->{name} = 'gmna';
>$layer_gmna->{status} = $mapscript::MS_ON;
>$layer_gmna->{type} = $mapscript::MS_LAYER_POLYGON;
>$layer_gmna->{connection} = "host=$dbhost port=$dbport dbname=$dbname 
> user=$dbuser password=$dbpswd";
>$layer_gmna->setConnectionType($mapscript::MS_POSTGIS, '');
>$layer_gmna->{data} = 'the_geom FROM ..';
>$layer_gmna->{classitem} = 'interval_name';
> 
>my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$dbhost;port=$dbport", 
> $dbuser, $dbpswd);
>>>> my $sth = $dbh->prepare("SELECT interval_name, color_hex FROM 
>>>> intervals_old");
>$sth->execute or debug $sth->errstr;
>while (my ($interval_name, $color_hex) = $sth->fetchrow_array) {
>my $classObj = new mapscript::classObj( $layer_gmna );
>$classObj->{name} = $interval_name;
>$classObj->setExpression( $interval_name );
>my $styleObj = styleObj(classObj => $classObj, colorObj => 
> colorObj('hex' => $color_hex));
>}
> 
> 
> By the time I reach the line marked with '>>>', the db connection is closed. 
> I get the following message: "DBD::Pg::st execute failed: server closed the 
> connection unexpectedly. This probably means the server terminated abnormally 
> before or while processing the request. at 
> /Users/punkish/Documents/www/geomaps/lib/geomaps.pm line 1225."
> 
> Maybe MapServer has nothing to do with it, but, is it possible that MapServer 
> efficiently closes all DB connections after it has pulled in the data from 
> the tables? If so, is there a way I can stop it from doing so?

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] MapScript WMS request

2011-09-07 Thread Mr. Puneet Kishor
I am trying to convert my MapScript program to a WMS responder. I create my 
$map where I set all the layers and classes and colors, etc, just like for a 
normal, non-WMS request that works perfectly correctly.

  my $map = undef;
  $map = mapObj(name => 'mymap') unless defined $map;
  
  my $req = new mapscript::OWSRequest();
  $req->setParameter( "SERVICE", "WMS" );
  $req->setParameter( "VERSION", "1.1.0" );
  $req->setParameter( "REQUEST", "GetCapabilities" );
  
  mapscript::msIO_installStdoutToBuffer();
  my $dispatch_out = $map->OWSDispatch( $req );
  printf "%s\n", mapscript::msIO_getStdoutBufferString();

Except, the above doesn't really do anything for me. I get nothing in my 
browser. Suggestions?


--
Puneet Kishor ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: MapScript WMS request

2011-09-07 Thread Mr . Puneet Kishor

On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:

> I am trying to convert my MapScript program to a WMS responder. I create my 
> $map where I set all the layers and classes and colors, etc, just like for a 
> normal, non-WMS request that works perfectly correctly.
> 
>  my $map = undef;
>  $map = mapObj(name => 'mymap') unless defined $map;
> 
>  my $req = new mapscript::OWSRequest();
>  $req->setParameter( "SERVICE", "WMS" );
>  $req->setParameter( "VERSION", "1.1.0" );
>  $req->setParameter( "REQUEST", "GetCapabilities" );

I changed the above line to 

   $req->setParameter( "REQUEST", "GetMap");

but, still no improvement.


> 
>  mapscript::msIO_installStdoutToBuffer();
>  my $dispatch_out = $map->OWSDispatch( $req );
>  printf "%s\n", mapscript::msIO_getStdoutBufferString();
> 
> Except, the above doesn't really do anything for me. I get nothing in my 
> browser. Suggestions?
> 
> 
> --
> Puneet Kishor

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: MapScript WMS request

2011-09-07 Thread Mr . Puneet Kishor
I would really appreciate insight from someone well-versed in the ins and outs 
of WMS via MapScript. Looking at the discussion at 
[http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` step 
seems to be a crucial part of drawing the image.

So, I added `my $img = $map->draw();` to my code below, and indeed, the image 
was drawn and sent back to the browser.

Is this something that should be added to the examples in the documentation? Is 
this the right way to do things? In any case, I am not write to STDOUT, and 
sending the buffer directly. Instead, my code is very much like a regular 
request (and it works) --

my $new_extent = $map->{extent};

my $req = new mapscript::OWSRequest();
$req->setParameter( "SERVICE", "WMS" );
$req->setParameter( "VERSION", "1.1.0" );
$req->setParameter( "REQUEST", "GetMap" );
$req->setParameter( "BBOX", "-180,-90,180,90" );
$req->setParameter( "LAYERS", "layer_name");
$req->setParameter( "SRS", "-1");
$req->setParameter( "WIDTH", "1200");
$req->setParameter( "HEIGHT", "600");

my $dispatch_out = $map->OWSDispatch( $req );
my $img = $map->draw();
my $map_img = 'test_' . sprintf("%0.10d", rand(100000)) . '.png';
$img->save("/path/to/$map_img");
return send_file("/path/to/$map_img");


Comments? Corrections?


On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:

> 
> On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:
> 
>> I am trying to convert my MapScript program to a WMS responder. I create my 
>> $map where I set all the layers and classes and colors, etc, just like for a 
>> normal, non-WMS request that works perfectly correctly.
>> 
>> my $map = undef;
>> $map = mapObj(name => 'mymap') unless defined $map;
>> 
>> my $req = new mapscript::OWSRequest();
>> $req->setParameter( "SERVICE", "WMS" );
>> $req->setParameter( "VERSION", "1.1.0" );
>> $req->setParameter( "REQUEST", "GetCapabilities" );
> 
> I changed the above line to 
> 
>   $req->setParameter( "REQUEST", "GetMap");
> 
> but, still no improvement.
> 
> 
>> 
>> mapscript::msIO_installStdoutToBuffer();
>> my $dispatch_out = $map->OWSDispatch( $req );
>> printf "%s\n", mapscript::msIO_getStdoutBufferString();
>> 
>> Except, the above doesn't really do anything for me. I get nothing in my 
>> browser. Suggestions?
>> 
>> 
>> --
>> Puneet Kishor
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 7, 2011, at 10:29 PM, Frank Warmerdam wrote:

> On 11-09-07 08:18 PM, Mr. Puneet Kishor wrote:
>> I would really appreciate insight from someone well-versed in the ins and 
>> outs of WMS via MapScript. Looking at the discussion at 
>> [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` 
>> step seems to be a crucial part of drawing the image.
>> 
>> So, I added `my $img = $map->draw();` to my code below, and indeed, the 
>> image was drawn and sent back to the browser.
>> 
>> Is this something that should be added to the examples in the documentation? 
>> Is this the right way to do things? In any case, I am not write to STDOUT, 
>> and sending the buffer directly. Instead, my code is very much like a 
>> regular request (and it works) --
>> 
>> my $new_extent = $map->{extent};
>> 
>> my $req = new mapscript::OWSRequest();
>> $req->setParameter( "SERVICE", "WMS" );
>> $req->setParameter( "VERSION", "1.1.0" );
>> $req->setParameter( "REQUEST", "GetMap" );
>> $req->setParameter( "BBOX", "-180,-90,180,90" );
>> $req->setParameter( "LAYERS", "layer_name");
>> $req->setParameter( "SRS", "-1");
>> $req->setParameter( "WIDTH", "1200");
>> $req->setParameter( "HEIGHT", "600");
>> 
>> my $dispatch_out = $map->OWSDispatch( $req );
>> my $img = $map->draw();
>> my $map_img = 'test_' . sprintf("%0.10d", rand(10)) . '.png';
>> $img->save("/path/to/$map_img");
>> return send_file("/path/to/$map_img");
>> 
>> 
>> Comments? Corrections?
> 
> Puneet,
> 
> I rarely use PHP and it is possible something is broken now with PHP
> OWS dispatching.  But it should work like:
> 
>  http://mapserver.org/ogc/mapscript.html#php-example
> 
> Alternatively if you don't install the stdout redirection the OWSDispatch
> call should produce the image to stdout.
> 
> Note that if you want things handled properly as a WMS request you should
> not be calling draw().  The ticket you reference long predates the WxS
> MapScript services effort.
> 
> I suspect you are not really setting all the environment variables needed
> to make the WMS handler kick in during OWSDispatch though I'd have to
> play around with it to be sure.
> 

Frank,

The above code was for (ahem) Perl MapScript. I am sure you are correct that I 
am not setting all the environment variables. I am hoping for a tutorial or 
code fragment that shows how to do it correctly. The one in the documentation 
that I am following doesn't seem to have any more than what I am setting. The 
following is the entirety of my non-working code (simplified bit for brevity, 
and also available with syntax highlighting at [http://pastebin.com/fz6MCXpm]) 
--

  use DBI;
  use mapscript;
  
  my $map = new mapscript::mapObj() or warn "error: 
$mapscript::ms_error->{message}\n";
  
  $map->{name} = 'mymap';
  $map->{status} = $mapscript::MS_ON;
  $map->{units} = $mapscript::MS_DD;
  $map->setImageType('png');
  
  my $imageColor = new mapscript::colorObj;
  $imageColor->setHex('#FF');
  $map->{imagecolor} = $imageColor;
  
  $map->setSize(1200, 600);
  $map->setExtent(-180, -90, 180, 90);
  $map->selectOutputFormat('png');
  $map->setProjection("proj=latlong");
  
  my $outputFormatObj = new mapscript::outputFormatObj('AGG/PNG');
  $outputFormatObj->setExtension('png');
  $outputFormatObj->setMimetype('image/png');
  $outputFormatObj->{imagemode} = $mapscript::MS_IMAGEMODE_RGB;
  $map->setOutputFormat( $outputFormatObj );
  
  my $layerOne = new mapscript::layerObj($map);
  $layerOne->{name} = "layer one";
  $layerOne->{status} = $mapscript::MS_ON;
  $layerOne->{type} = $mapscript::MS_LAYER_POLYGON;
  $layerOne->{opacity} = 100;
  $layerOne->{connection} = 'host=localhost port=5432 dbname=mydb user=dbuser 
password=dbpasswd';
  $layerOne->setConnectionType($mapscript::MS_POSTGIS, '');
  $layerOne->{data} = 'the_geom FROM (SELECT class_name, the_geom FROM t1) 
a_view USING UNIQUE gid USING srid=-1';
  $layerOne->{classitem} = 'class_name';
  $layerOne->setProjection("proj=latlong");
  
  my $classOutlineColor = new mapscript::colorObj;
  $classOutlineColor->setHex('#44');
  
  my $sth = database->prepare('SELECT class_name, class_color FROM t2&#x

[mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Mr . Puneet Kishor
a bit more investigation on producing a WMS response via Perl MapScript reveals 
the following error

  
  http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd";>
  
  
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
wms/ows_enable_request settings.
  
  

So, it seems I have to somehow, somewhere enable 'ows_enable_request'. Looking 
at the documentation, seems like if I had a map file, I could add the following 
line to do so

  ows_enable_request '*'

However, I am not using a map file at all. Not finding any documentation on 
this setting, I tried the following to no avail

  $map->{ows_enable_request} = '*';


Suggestions, anyone?


On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:

> I would really appreciate insight from someone well-versed in the ins and 
> outs of WMS via MapScript. Looking at the discussion at 
> [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` step 
> seems to be a crucial part of drawing the image.
> 
> So, I added `my $img = $map->draw();` to my code below, and indeed, the image 
> was drawn and sent back to the browser.
> 
> Is this something that should be added to the examples in the documentation? 
> Is this the right way to do things? In any case, I am not write to STDOUT, 
> and sending the buffer directly. Instead, my code is very much like a regular 
> request (and it works) --
> 
>my $new_extent = $map->{extent};
> 
>my $req = new mapscript::OWSRequest();
>$req->setParameter( "SERVICE", "WMS" );
>$req->setParameter( "VERSION", "1.1.0" );
>$req->setParameter( "REQUEST", "GetMap" );
>$req->setParameter( "BBOX", "-180,-90,180,90" );
>$req->setParameter( "LAYERS", "layer_name");
>$req->setParameter( "SRS", "-1");
>$req->setParameter( "WIDTH", "1200");
>$req->setParameter( "HEIGHT", "600");
> 
>my $dispatch_out = $map->OWSDispatch( $req );
>    my $img = $map->draw();
>my $map_img = 'test_' . sprintf("%0.10d", rand(10)) . '.png';
>$img->save("/path/to/$map_img");
>return send_file("/path/to/$map_img");
> 
> 
> Comments? Corrections?
> 
> 
> On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:
> 
>> 
>> On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:
>> 
>>> I am trying to convert my MapScript program to a WMS responder. I create my 
>>> $map where I set all the layers and classes and colors, etc, just like for 
>>> a normal, non-WMS request that works perfectly correctly.
>>> 
>>> my $map = undef;
>>> $map = mapObj(name => 'mymap') unless defined $map;
>>> 
>>> my $req = new mapscript::OWSRequest();
>>> $req->setParameter( "SERVICE", "WMS" );
>>> $req->setParameter( "VERSION", "1.1.0" );
>>> $req->setParameter( "REQUEST", "GetCapabilities" );
>> 
>> I changed the above line to 
>> 
>>  $req->setParameter( "REQUEST", "GetMap");
>> 
>> but, still no improvement.
>> 
>> 
>>> 
>>> mapscript::msIO_installStdoutToBuffer();
>>> my $dispatch_out = $map->OWSDispatch( $req );
>>> printf "%s\n", mapscript::msIO_getStdoutBufferString();
>>> 
>>> Except, the above doesn't really do anything for me. I get nothing in my 
>>> browser. Suggestions?
>>> 
>>> 
>>> --
>>> Puneet Kishor
>> 
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 1:03 PM, thomas bonfort wrote:

> it goes in map->web->metadata
> 

I guessed as much, but I can't fathom the syntax. The webObj doesn't seem to 
have any constructor, and I don't see any documentation. Could you please point 
me to an example?



> 
> On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishor  wrote:
>> a bit more investigation on producing a WMS response via Perl MapScript 
>> reveals the following error
>> 
>>  
>>  > "http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd";>
>>  
>>  
>>  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
>> wms/ows_enable_request settings.
>>  
>>  
>> 
>> So, it seems I have to somehow, somewhere enable 'ows_enable_request'. 
>> Looking at the documentation, seems like if I had a map file, I could add 
>> the following line to do so
>> 
>>  ows_enable_request '*'
>> 
>> However, I am not using a map file at all. Not finding any documentation on 
>> this setting, I tried the following to no avail
>> 
>>  $map->{ows_enable_request} = '*';
>> 
>> 
>> Suggestions, anyone?
>> 
>> 
>> On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:
>> 
>>> I would really appreciate insight from someone well-versed in the ins and 
>>> outs of WMS via MapScript. Looking at the discussion at 
>>> [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` 
>>> step seems to be a crucial part of drawing the image.
>>> 
>>> So, I added `my $img = $map->draw();` to my code below, and indeed, the 
>>> image was drawn and sent back to the browser.
>>> 
>>> Is this something that should be added to the examples in the 
>>> documentation? Is this the right way to do things? In any case, I am not 
>>> write to STDOUT, and sending the buffer directly. Instead, my code is very 
>>> much like a regular request (and it works) --
>>> 
>>>my $new_extent = $map->{extent};
>>> 
>>>my $req = new mapscript::OWSRequest();
>>>$req->setParameter( "SERVICE", "WMS" );
>>>$req->setParameter( "VERSION", "1.1.0" );
>>>$req->setParameter( "REQUEST", "GetMap" );
>>>$req->setParameter( "BBOX", "-180,-90,180,90" );
>>>$req->setParameter( "LAYERS", "layer_name");
>>>$req->setParameter( "SRS", "-1");
>>>$req->setParameter( "WIDTH", "1200");
>>>$req->setParameter( "HEIGHT", "600");
>>> 
>>>my $dispatch_out = $map->OWSDispatch( $req );
>>>my $img = $map->draw();
>>>my $map_img = 'test_' . sprintf("%0.10d", rand(10)) . '.png';
>>>$img->save("/path/to/$map_img");
>>>return send_file("/path/to/$map_img");
>>> 
>>> 
>>> Comments? Corrections?
>>> 
>>> 
>>> On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:
>>> 
>>>> 
>>>> On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:
>>>> 
>>>>> I am trying to convert my MapScript program to a WMS responder. I create 
>>>>> my $map where I set all the layers and classes and colors, etc, just like 
>>>>> for a normal, non-WMS request that works perfectly correctly.
>>>>> 
>>>>> my $map = undef;
>>>>> $map = mapObj(name => 'mymap') unless defined $map;
>>>>> 
>>>>> my $req = new mapscript::OWSRequest();
>>>>> $req->setParameter( "SERVICE", "WMS" );
>>>>> $req->setParameter( "VERSION", "1.1.0" );
>>>>> $req->setParameter( "REQUEST", "GetCapabilities" );
>>>> 
>>>> I changed the above line to
>>>> 
>>>>  $req->setParameter( "REQUEST", "GetMap");
>>>> 
>>>> but, still no improvement.
>>>> 
>>>> 
>>>>> 
>>>>> mapscript::msIO_installStdoutToBuffer();
>>>>> my $dispatch_out = $map->OWSDispatch( $req );
>>>>> printf "%s\n", mapscript::msIO_getStdoutBufferString();
>>>>> 
>>>>> Except, the above doesn't really do anything for me. I get nothing in my 
>>>>> browser. Suggestions?
>>>>> 
>>>>> 
>>>>> --
>>>>> Puneet Kishor
>>>> 
>>> 
>> 
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor
top posting, as most of the relevant info is self-contained in this email --

Ok, with the help of the suggestions from many of you, and by adding the 
following lines to my program, I am no longer getting any error.

..
$map->setMetaData("ows_enable_request", "*");

..
$map->setProjection("init=epsg:4326");

..
$layerOne->setProjection("init=epsg:4326");

..
my $req = new mapscript::OWSRequest();
$req->setParameter("SERVICE", "WMS" );
$req->setParameter("VERSION", "1.1.0" );
$req->setParameter("REQUEST", "GetMap" );
$req->setParameter("BBOX", "-180,-90,180,90" );
$req->setParameter("LAYERS", "mylayer");
$req->setParameter("SRS", "EPSG:4326");
$req->setParameter("WIDTH", "1200");
$req->setParameter("HEIGHT", "600");
$req->setParameter("FORMAT", "image/png");

my $io = mapscript::msIO_installStdoutToBuffer();
my $dispatch_out = $map->OWSDispatch( $req );
printf "%s\n", mapscript::msIO_getStdoutBufferString();

The only problem is -- I am getting an image with nothing in it. This implies 
that I have likely got all the params for WMS correct, but now I am screwing up 
with some step in the layer creation. The interesting thing is, this is the 
same code that works fine as a regular MapServer request; makes an image fast 
and quick and correct. Is there a way I can add error logging to my WMS program 
to see what is going on at every step? Perhaps capture the database query being 
made, etc.


On Sep 8, 2011, at 1:22 PM, Frank Warmerdam wrote:

> Puneet,
> 
> I would add that there is a lot of other metadata that you need to set on a
> map in order to get WxS services like WMS working.  If you haven't done
> that either you are going to be frustrated.
> 
> I would suggest getting your script working initially with an actual mapfile
> and then if you really want to construct the map programmatically use
> that as a guide.
> 
> Best regards,
> 
> On Thu, Sep 8, 2011 at 11:15 AM, Armin Burger  wrote:
>> in PHP MapScript should be something like
>>  $map->setMetaData("ows_enable_request", "*");
>> 
>> in Python:
>>  map.setMetaData("ows_enable_request", "*")
>> 
>> armin
>> 
>> 
>> On 08/09/2011 20:05, Mr. Puneet Kishor wrote:
>>> 
>>> On Sep 8, 2011, at 1:03 PM, thomas bonfort wrote:
>>> 
>>>> it goes in map->web->metadata
>>>> 
>>> 
>>> I guessed as much, but I can't fathom the syntax. The webObj doesn't seem
>>> to have any constructor, and I don't see any documentation. Could you please
>>> point me to an example?
>>> 
>>> 
>>> 
>>>> 
>>>> On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishor
>>>>  wrote:
>>>>> 
>>>>> a bit more investigation on producing a WMS response via Perl MapScript
>>>>> reveals the following error
>>>>> 
>>>>>  
>>>>>  >>>> "http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd";>
>>>>>  
>>>>>  
>>>>>  msWMSDispatch(): WMS server error. WMS request not enabled. Check
>>>>> wms/ows_enable_request settings.
>>>>>  
>>>>>  
>>>>> 
>>>>> So, it seems I have to somehow, somewhere enable 'ows_enable_request'.
>>>>> Looking at the documentation, seems like if I had a map file, I could add
>>>>> the following line to do so
>>>>> 
>>>>>  ows_enable_request '*'
>>>>> 
>>>>> However, I am not using a map file at all. Not finding any documentation
>>>>> on this setting, I tried the following to no avail
>>>>> 
>>>>>  $map->{ows_enable_request} = '*';
>>>>> 
>>>>> 
>>>>> Suggestions, anyone?
>>>>> 
>>>>> 
>>>>> On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:
>>>>> 
>>>>>> I would really appreciate insight from someone well-versed in the ins
>>>>>> and outs of WMS via MapScript. Looking at the discussion at
>>>>>> [http://trac.osgeo.org/mapserver/ticket/670], the `i

[mapserver-users] advice on best practice for MapServer layer in OL/Gmaps

2011-09-08 Thread Mr. Puneet Kishor
In another tortured thread I am seeking advice on WMS with MapScript. My 
ultimate intent is to provide MapServer layers in OL/Gmaps/(some_other) web 
app. I need to use MapScript because of the flexibility and freedom it gives me 
in querying my datasources, and in constructing the map. 

Do I have to use WMS? What, if any, are the alternative? I notice that 
MapServer now has a `mode=tile` that is designed with Gmaps kinda app in mind. 
Is that a better mode? Would that work with OL as well? Or with Leaflet or some 
other client-side web mapping framework?

Its been a while since I have used MapServer extensively for creating a 
full-fledged app, but the time to do is coming up now. I would really 
appreciate any advice on this front.

Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor
Great suggestions Daniel. Here is what I have to report --


On Sep 8, 2011, at 6:27 PM, Daniel Morissette wrote:

> Hi Puneet,
> 
> A few things to try:
> 
> 1- Reduce your map to a single layer if that's not already the case for your 
> first round of tests.


It is already reduced to a single layer.


> 
> 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows up 
> properly and with no WARNING in the GetCapabilities XML output. Make sure the 
> name of the layer is not changed: if you have multiple layers with the same 
> name then the WMS handler will rename them to make them unique (WMS spec 
> requirement)


That was very useful. No errors, but I do notice the following funky issue (see 
below)

   
gmna
gmna
EPSG:4326



  default
  default
  
 image/png
 http://www.w3.org/1999/xlink"; 
xlink:type="simple" 
xlink:href="http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&service=WMS&request=GetLegendGraphic&layer=gmna&format=image/png&STYLE=default"/>
  



Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I didn't 
add that. All I did was query in lat/lon. Maybe that is where my error remains 
now.


> ..
> 
> 4- Frank's earlier suggestion to start by making things work from a regular 
> mapfile first and then converting/moving stuff to mapscript progressively 
> still stands as a great option.
> ..

Indeed, a great suggestion. Actually, that is exactly how I started. Got 
everything working with a Mapfile, then migrated to MapScript (I am touching 
MapScript after many years now, perhaps half a decade), got that working, and 
am now on to WMS.

Anyway, I seem to be close to a resolution. Something is going on with my 
BoundingBox.

Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr . Puneet Kishor
fwiw, here is the pastebin link to the XML response to my GetCapabilities 
request. http://pastebin.com/zu8kjNDX

On Sep 8, 2011, at 6:44 PM, Mr. Puneet Kishor wrote:

> Great suggestions Daniel. Here is what I have to report --
> 
> 
> On Sep 8, 2011, at 6:27 PM, Daniel Morissette wrote:
> 
>> Hi Puneet,
>> 
>> A few things to try:
>> 
>> 1- Reduce your map to a single layer if that's not already the case for your 
>> first round of tests.
> 
> 
> It is already reduced to a single layer.
> 
> 
>> 
>> 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows 
>> up properly and with no WARNING in the GetCapabilities XML output. Make sure 
>> the name of the layer is not changed: if you have multiple layers with the 
>> same name then the WMS handler will rename them to make them unique (WMS 
>> spec requirement)
> 
> 
> That was very useful. No errors, but I do notice the following funky issue 
> (see below)
> 
>   
>gmna
>gmna
>EPSG:4326
> maxy="2.5e+07" />
>minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" 
> maxy="2.5e+07" />
>
>  <Name>default</Name>
>  <Title>default</Title>
>  <LegendURL width="167" height="7029">
> <Format>image/png</Format>
> <OnlineResource xmlns:xlink="<a  rel="nofollow" href="http://www.w3.org/1999/xlink"">http://www.w3.org/1999/xlink"</a>; 
> xlink:type="simple" 
> xlink:href="<a  rel="nofollow" href="http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;STYLE=default"/">http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;STYLE=default"/</a>>
>  </LegendURL>
>
> 
> 
> Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I 
> didn't add that. All I did was query in lat/lon. Maybe that is where my error 
> remains now.
> 
> 
>> ..
>> 
>> 4- Frank's earlier suggestion to start by making things work from a regular 
>> mapfile first and then converting/moving stuff to mapscript progressively 
>> still stands as a great option.
>> ..
> 
> Indeed, a great suggestion. Actually, that is exactly how I started. Got 
> everything working with a Mapfile, then migrated to MapScript (I am touching 
> MapScript after many years now, perhaps half a decade), got that working, and 
> am now on to WMS.
> 
> Anyway, I seem to be close to a resolution. Something is going on with my 
> BoundingBox.
> 
> Puneet.
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 6:52 PM, Daniel Morissette wrote:

> On 11-09-08 07:44 PM, Mr. Puneet Kishor wrote:
>> 
>>> 
>>> 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows 
>>> up properly and with no WARNING in the GetCapabilities XML output. Make 
>>> sure the name of the layer is not changed: if you have multiple layers with 
>>> the same name then the WMS handler will rename them to make them unique 
>>> (WMS spec requirement)
>> 
>> 
>> That was very useful. No errors, but I do notice the following funky issue 
>> (see below)
>> 
>>
>> gmna
>> gmna
>> EPSG:4326
>> > maxy="2.5e+07" />
>> > minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" 
>> maxy="2.5e+07" />
>> 
>>   <Name>default</Name>
>>   <Title>default</Title>
>>   <LegendURL width="167" height="7029">
>>  <Format>image/png</Format>
>>  <OnlineResource xmlns:xlink="<a  rel="nofollow" href="http://www.w3.org/1999/xlink"">http://www.w3.org/1999/xlink"</a>; 
>> xlink:type="simple" 
>> xlink:href="<a  rel="nofollow" href="http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;STYLE=default"/">http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;STYLE=default"/</a>>
>>   </LegendURL>
>> 
>> 
>> 
>> Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I 
>> didn't add that. All I did was query in lat/lon. Maybe that is where my 
>> error remains now.
>> 
> 
> What is your data? a Shapefile? What is the source projection of the data?

PostGIS. lat/lng. SRID 4326

> 
> I suspect the BoundingBox is invalid because the layer projection is not set 
> to the right value. Those funky numbers look like values in meters, so 
> presumably your data is in a projected coordinate system.
> 
> In your script you set:
>   $layerOne->setProjection("init=epsg:4326");

Already have that line in both $mapObj and in the $layerObj

$map->setProjection("init=epsg:4326");
..
$layerOne->setProjection("init=epsg:4326");


> 
> This will work only if your data is in EPSG:4326. If that's not the case then 
> you need to set the layer projection to match the source data.
> 

punkish@lucknow$/opt/local/lib/postgresql90/bin/psql -U postgres -d macromap
psql (9.0.4)
Type "help" for help.

macromap=# SELECT ST_SRID(the_geom) FROM gmna LIMIT 1;
 st_srid 
-
4326
(1 row)

macromap=# SELECT * FROM geometry_columns WHERE f_table_name = 'gmna';
 f_table_catalog | f_table_schema | f_table_name | f_geometry_column | 
coord_dimension | srid | type 
-++--+---+-+--+--
 | gmna   | gmna | the_geom  |  
 2 | 4326 | MULTIPOLYGON
(1 row)

macromap=#


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr . Puneet Kishor

On Sep 8, 2011, at 7:16 PM, Mr. Puneet Kishor wrote:

> 
> On Sep 8, 2011, at 6:52 PM, Daniel Morissette wrote:
> 
>> On 11-09-08 07:44 PM, Mr. Puneet Kishor wrote:
>>> 
>>>> 
>>>> 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows 
>>>> up properly and with no WARNING in the GetCapabilities XML output. Make 
>>>> sure the name of the layer is not changed: if you have multiple layers 
>>>> with the same name then the WMS handler will rename them to make them 
>>>> unique (WMS spec requirement)
>>> 
>>> 
>>> That was very useful. No errors, but I do notice the following funky issue 
>>> (see below)
>>> 
>>>   
>>>gmna
>>>gmna
>>>EPSG:4326
>>>>> maxy="2.5e+07" />
>>>>>minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" 
>>> maxy="2.5e+07" />
>>>
>>>  <Name>default</Name>
>>>  <Title>default</Title>
>>>  <LegendURL width="167" height="7029">
>>> <Format>image/png</Format>
>>> <OnlineResource xmlns:xlink="<a  rel="nofollow" href="http://www.w3.org/1999/xlink"">http://www.w3.org/1999/xlink"</a>; 
>>> xlink:type="simple" 
>>> xlink:href="<a  rel="nofollow" href="http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;STYLE=default"/">http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;STYLE=default"/</a>>
>>>  </LegendURL>
>>>
>>> 
>>> 
>>> Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I 
>>> didn't add that. All I did was query in lat/lon. Maybe that is where my 
>>> error remains now.
>>> 
>> 
>> What is your data? a Shapefile? What is the source projection of the data?
> 
> PostGIS. lat/lng. SRID 4326
> 
>> 
>> I suspect the BoundingBox is invalid because the layer projection is not set 
>> to the right value. Those funky numbers look like values in meters, so 
>> presumably your data is in a projected coordinate system.
>> 
>> In your script you set:
>>  $layerOne->setProjection("init=epsg:4326");
> 
> Already have that line in both $mapObj and in the $layerObj
> 
>$map->setProjection("init=epsg:4326");
>..
>$layerOne->setProjection("init=epsg:4326");
> 
> 
>> 
>> This will work only if your data is in EPSG:4326. If that's not the case 
>> then you need to set the layer projection to match the source data.
>> 
> 
> punkish@lucknow$/opt/local/lib/postgresql90/bin/psql -U postgres -d macromap
> psql (9.0.4)
> Type "help" for help.
> 
> macromap=# SELECT ST_SRID(the_geom) FROM gmna LIMIT 1;
> st_srid 
> -
>4326
> (1 row)
> 
> macromap=# SELECT * FROM geometry_columns WHERE f_table_name = 'gmna';
> f_table_catalog | f_table_schema | f_table_name | f_geometry_column | 
> coord_dimension | srid | type 
> -++--+---+-+--+--
> | gmna   | gmna | the_geom  | 
>   2 | 4326 | MULTIPOLYGON
> (1 row)
> 
> macromap=#
> 
> 


I should have also added the following

macromap=# SELECT ST_AsText(the_geom) FROM gmna LIMIT 1;
MULTIPOLYGON(((170.095660072181 65.6251237164987,170.158707739831 
65.6269635224645,170.173265447057 65.6291258974802,170.2497277762 
65.6357072803021,170.257074956711 65.6372005203368,170.267729454865 
65.6409199441452,170.283323865029 65.6476938262634,170.30182707 
65.657286936117,170.370058904075 65.6852127397289,170.394158265237 
65.6971816353387,170.45719236517 65.7228758026517,170.477794791157 
65.7331303689249,170.501440218163 65.7431659781412,170.506165498289 
65.745957239196,170.509550359131 65.74948784687,170.517163313193 
65.7692852345393,170.523452830315 65.7856156337451,170.527911709329 
65.7872471861488,170.564509940928 65.8002968138894,170.605805308438 
65.815184809157,17


As you can see, everything is in lat/lng.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:

> On 11-09-08 08:40 PM, Mr. Puneet Kishor wrote:
>> 
>> On Sep 8, 2011, at 7:16 PM, Mr. Puneet Kishor wrote:
>>> 
>>> PostGIS. lat/lng. SRID 4326
>>> 
>>>> 
> [...]
>> 
>> 
>> I should have also added the following
>> 
>> macromap=# SELECT ST_AsText(the_geom) FROM gmna LIMIT 1;
>> MULTIPOLYGON(((170.095660072181 65.6251237164987,170.158707739831 
>> 65.6269635224645,170.173265447057 65.6291258974802,170.2497277762 
>> 65.6357072803021,170.257074956711 65.6372005203368,170.267729454865 
>> 65.6409199441452,170.283323865029 65.6476938262634,170.30182707 
>> 65.657286936117,170.370058904075 65.6852127397289,170.394158265237 
>> 65.6971816353387,170.45719236517 65.7228758026517,170.477794791157 
>> 65.7331303689249,170.501440218163 65.7431659781412,170.506165498289 
>> 65.745957239196,170.509550359131 65.74948784687,170.517163313193 
>> 65.7692852345393,170.523452830315 65.7856156337451,170.527911709329 
>> 65.7872471861488,170.564509940928 65.8002968138894,170.605805308438 
>> 65.815184809157,17
>> 
>> 
>> As you can see, everything is in lat/lng.
>> 
>> 
> 
> Thanks. That rules out the possibility of a data problem.
> 
> With PostGIS, the WMS extents reported for a layer cannot be derived from the 
> data. In the shapefile case we use the shapefile's extents, but this is not 
> readily available with postgis, so unless I'm mistaken, MapServer looks up 
> the wms/ows_extent metadata in the layer, and if not found then it falls back 
> on the map's EXTENT for the mandatory BoundingBox and LatLonBoundingBox 
> elements.
> 
> Maybe call $map->save("/tmp/my.map") in your script after the map and layer 
> have been populated and paste the result... that may give us a hint...
> 

wow! this is a super-awesome debugging technique. I have sent you the map file 
off list to not pollute the entire list serve.

Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:

> On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
>> 
>> On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
>>> 
>>> Maybe call $map->save("/tmp/my.map") in your script after the map and layer 
>>> have been populated and paste the result... that may give us a hint...
>>> 
>> 
>> wow! this is a super-awesome debugging technique. I have sent you the map 
>> file off list to not pollute the entire list serve.
>> 
> 
> I was able to reproduce the issue with the copy of the mapfile you sent 
> off-list.
> 
> It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
> always return
> 
> {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
> 
> ...and then it returns MS_SUCCESS.
> 
> I think this function should either be left unimplemented (this way MapServer 
> would fallback on other mechanisms), or return MS_FAILURE to indicate to the 
> calling code that it didn't do anything useful.
> 
> A quick search indicates an open ticket about the issue:
> 
> http://trac.osgeo.org/mapserver/ticket/3585
> 
> You could bump the ticket and hope someone works on it at the FOSS4G code 
> sprint next week.
> 
> The short term fix for you would be to set the "ows_extent" metadata in your 
> layer:
> 
>METADATA
>  "ows_extent" "-180 -90 180 90"
>   ...
>END
> 


Thanks Daniel. I will bump the ticket. For now, see below --

Using the "my.map" file I sent you, with no further modifications to it, I am 
able to successfully get an image back via 
[http://localhost.local/cgi-bin/gmna?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=-180,-90,180,90&SRS=EPSG:4326&WIDTH=1200&HEIGHT=600&LAYERS=gmna&STYLES=&FORMAT=image/png&TRANSPARENT=true]

Note, no further modifications is required, that is, not even the "ows_extent" 
"-180 -90 180 90" bit in the layer METADATA. and I still get a good image.


However, if I use the following program to access the same map file, I get the 
spurious "minx = -2500, miny = -2500, maxx = 2500, maxy = 2500" 
in the GetCapabilities.

Finally, if I add the "ows_extent" "-180 -90 180 90" line in the layer METADATA 
in the "my.map" file, the GetCapabilities returns the correct bounds now, 
however, the image is still blank.

#!/opt/local/bin/perl

use strict;
use mapscript;

my $wms = new mapscript::OWSRequest();
$wms->setParameter("SERVICE", "WMS" );
$wms->setParameter("VERSION", "1.1.1" );
$wms->setParameter("REQUEST", "GetMap" );
$wms->setParameter("BBOX", "-180,-90,180,90" );
$wms->setParameter("LAYERS", "gmna");
$wms->setParameter("SRS", "EPSG:4326");
$wms->setParameter("WIDTH", "1200");
$wms->setParameter("HEIGHT", "600");
$wms->setParameter("FORMAT", "image/png");
$wms->setParameter("TRANSPARENT", "true");

my $map = new 
mapscript::mapObj("/Users/punkish/Sites/test/mapscript/my.map");

if(!$map) {
warn "New mapObj() error: $mapscript::ms_error->{message}\n";
}

my $io = mapscript::msIO_installStdoutToBuffer();
my $dispatch_out = $map->OWSDispatch( $wms );
printf "%s\n", mapscript::msIO_getStdoutBufferString();

I have now spent an enormous amount of time on this, and for now, I have to 
move on. This is just not working out. Maybe I will try some other technique, 
perhaps this mode=tile to see if I can get MapServer powered maps in my apps.

Thanks much for your help. If you (or anyone else) can come up with a bright 
idea, I will be happy to try it.

Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] mode=tile and MapScript

2011-09-08 Thread Mr. Puneet Kishor
I am trying out mode=tile as detailed at 
[http://mapserver.org/output/tile_mode.html], and actually, it works great! 
Might be able to avoid the pains of WMS completely.

However, it works great with MapServer CGI. What if I want to use MapScript? In 
other words, instead of 

var urlTemplate = 'http://localhost/cgi-bin/myapp?';
urlTemplate += 'layers=layer1 layer2&';
urlTemplate += 'mode=tile&';
urlTemplate += 'tilemode=gmap&';
urlTemplate += 'tile={X}+{Y}+{Z}';

I have

var urlTemplate = 'http://localhost/myapp.cgi?';
urlTemplate += 'tile={X}+{Y}+{Z}';

and I add mode=tile and tilemode=gmap on the server side. My question is -- 
one, will the above work? and, how do I pass mode=tile and tilemode=gmap and 
the tile={X}+{Y}+{Z} parameters to the program? I didn't see any MapScript 
documentation for these parameters. I need to translate a call such as 
[http://localhost/cgi-bin/myapp?layers=layer1&mode=tile&tilemode=gmap&tile=30+46+7]
 into a MapScript request.

Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] MapScript WMS request

2011-09-09 Thread Mr. Puneet Kishor

On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:

> Puneet, 
> 
> As far as I know, OpenLayers still has support for a layer based on MapServer 
> CGI.  Because MapServer can also serve up WMS well, this layer type isn't 
> necessarily recommended or as well supported.  
> 
> http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html



Indeed David. Because, going by the docs, the MapServer CGI calls are 
discouraged (or so it seems), I'd rather not invest in that path. This is a 
long term project that I am working on, so the foundations have to be very 
robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
looking at other frameworks (Gmaps, Leaflet, Polymaps), and it would be wise to 
decouple the backend from the front-end as much as possible.

I have no issues with using WMS, but I just am unable to get MapServer WMS to 
work via MapScript. And, yes, I do have to use MapScript if I can help it -- my 
layer classification is generated on demand, and MapScript is the easiest way I 
can think of for doing that.

I did find yesterday that `mode=tile` works really well, but I am trying to 
make that work with MapScript. A separate email thread for that question.




> 
> David.
> 
> -Original Message-
> From: mapserver-users-boun...@lists.osgeo.org 
> [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
> Kishor
> Sent: Thursday, September 08, 2011 9:32 PM
> To: Daniel Morissette
> Cc: mapserver-users@lists.osgeo.org
> Subject: Re: [mapserver-users] MapScript WMS request
> 
> 
> On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:
> 
>> On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
>>> 
>>> On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
>>>> 
>>>> Maybe call $map->save("/tmp/my.map") in your script after the map and 
>>>> layer have been populated and paste the result... that may give us a 
>>>> hint...
>>>> 
>>> 
>>> wow! this is a super-awesome debugging technique. I have sent you the map 
>>> file off list to not pollute the entire list serve.
>>> 
>> 
>> I was able to reproduce the issue with the copy of the mapfile you sent 
>> off-list.
>> 
>> It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
>> always return
>> 
>> {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
>> 
>> ...and then it returns MS_SUCCESS.
>> 
>> I think this function should either be left unimplemented (this way 
>> MapServer would fallback on other mechanisms), or return MS_FAILURE to 
>> indicate to the calling code that it didn't do anything useful.
>> 
>> A quick search indicates an open ticket about the issue:
>> 
>> http://trac.osgeo.org/mapserver/ticket/3585
>> 
>> You could bump the ticket and hope someone works on it at the FOSS4G code 
>> sprint next week.
>> 
>> The short term fix for you would be to set the "ows_extent" metadata in your 
>> layer:
>> 
>>   METADATA
>> "ows_extent" "-180 -90 180 90"
>>  ...
>>   END
>> 
> 
> 
> Thanks Daniel. I will bump the ticket. For now, see below --
> 
> Using the "my.map" file I sent you, with no further modifications to it, I am 
> able to successfully get an image back via 
> [http://localhost.local/cgi-bin/gmna?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=-180,-90,180,90&SRS=EPSG:4326&WIDTH=1200&HEIGHT=600&LAYERS=gmna&STYLES=&FORMAT=image/png&TRANSPARENT=true]
> 
> Note, no further modifications is required, that is, not even the 
> "ows_extent" "-180 -90 180 90" bit in the layer METADATA. and I still get a 
> good image.
> 
> 
> However, if I use the following program to access the same map file, I get 
> the spurious "minx = -2500, miny = -2500, maxx = 2500, maxy = 
> 2500" in the GetCapabilities.
> 
> Finally, if I add the "ows_extent" "-180 -90 180 90" line in the layer 
> METADATA in the "my.map" file, the GetCapabilities returns the correct bounds 
> now, however, the image is still blank.
> 
>   #!/opt/local/bin/perl
>   
>   use strict;
>   use mapscript;
>   
>   my $wms = new mapscript::OWSRequest();
>   $wms->setParameter("SERVICE", "WMS" );
>   $wms->setParameter("VERSION", "1.1.1" );
>   $wms->setParameter("REQUEST", "GetMap" );
>   $wms->setParameter("BBOX", "-180,-90,180

Re: [mapserver-users] MapScript WMS request

2011-09-09 Thread Mr. Puneet Kishor
David,


On Sep 9, 2011, at 9:47 AM, Fawcett, David (MPCA) wrote:

> Puneet, 
> 
> Using MapServer CGI and layer.MapServer would not set you up well for other 
> client libraries, so I see your point.  It can be viable though.
> 
> In this app (just an imagemap, not OL), there are no attribute values 
> associated with the spatial data.  The classes are generated on-the-fly and 
> the county id's for each class are passed in as URL vars.  Same thing for the 
> legend.  This allows flexibility for compounds who's emissions may vary from 
> tens of pounds to millions of pounds.
> 
> This approach may not work for your case, but it is another way to slice it...


Possibly. See, it is crucially important for me to be able to generate classes 
on the fly, and with a lot of flexibility. Not just that, the criteria for 
generating the classes can change. So, what I am doing actually is setting up a 
separate application that does nothing but respond with class information. The 
mapping application (and, any other application, for that matter), would query 
this class generating application and make the classes as per the latest 
information. Hence, my need for MapScripting. Well, there are other reasons as 
well, but this is an important one.


> 
> http://www.pca.state.mn.us/index.php/topics/environmental-data/eda-environmental-data-access/eda-air-quality-searches/eda-air-quality-search-emissions-by-county-data.html



By the way, the app above is not working. I get broken images, and the 
following errors in the web inspector (that might help you troubleshoot)


GET http://www.pca.state.mn.us/oea/css/master.css 404 (Not Found)

emissions.cfm:28 ReferenceError: Can't find variable: urchinTracker

GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with the 
specified hostname could not be found.

GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with the 
specified hostname could not be found.

GET 
http://cf.pca.state.mn.us/data/edaAir/artwork/edaP2results_edaAmbientResultsPollutantsJuly_04.gif
 404 (Not Found)

master-print.cssGET http://www.pca.state.mn.us/oea/css/master-print.css 404 
(Not Found)




> 
> David.
> 
> -Original Message-
> From: mapserver-users-boun...@lists.osgeo.org 
> [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
> Kishor
> Sent: Friday, September 09, 2011 9:35 AM
> To: mapserver-users@lists.osgeo.org
> Subject: Re: [mapserver-users] MapScript WMS request
> 
> 
> On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:
> 
>> Puneet, 
>> 
>> As far as I know, OpenLayers still has support for a layer based on 
>> MapServer CGI.  Because MapServer can also serve up WMS well, this layer 
>> type isn't necessarily recommended or as well supported.  
>> 
>> http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html
> 
> 
> 
> Indeed David. Because, going by the docs, the MapServer CGI calls are 
> discouraged (or so it seems), I'd rather not invest in that path. This is a 
> long term project that I am working on, so the foundations have to be very 
> robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
> looking at other frameworks (Gmaps, Leaflet, Polymaps), and it would be wise 
> to decouple the backend from the front-end as much as possible.
> 
> I have no issues with using WMS, but I just am unable to get MapServer WMS to 
> work via MapScript. And, yes, I do have to use MapScript if I can help it -- 
> my layer classification is generated on demand, and MapScript is the easiest 
> way I can think of for doing that.
> 
> I did find yesterday that `mode=tile` works really well, but I am trying to 
> make that work with MapScript. A separate email thread for that question.
> 
> 
> 
> 
>> 
>> David.
>> 
>> -Original Message-
>> From: mapserver-users-boun...@lists.osgeo.org 
>> [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
>> Kishor
>> Sent: Thursday, September 08, 2011 9:32 PM
>> To: Daniel Morissette
>> Cc: mapserver-users@lists.osgeo.org
>> Subject: Re: [mapserver-users] MapScript WMS request
>> 
>> 
>> On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:
>> 
>>> On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
>>>> 
>>>> On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
>>>>> 
>>>>> Maybe call $map->save("/tmp/my.map") in your script after the map and 
>>>>> layer have been populated and paste the result... that may give us a 
>>>>> hint...
>>>>> 
>>>> 
>>>> wow! this is a super-awesome debu

[mapserver-users] Re: mode=tile and MapScript

2011-09-10 Thread Mr . Puneet Kishor
knock, knock...

any suggestions on the MapScript syntax for setting 
`mode=tile&tilemode=gmap&tile={X}+{Y}+{Z}` were X, Y, Z are received as http 
query params?


On Sep 8, 2011, at 10:23 PM, Mr. Puneet Kishor wrote:

> I am trying out mode=tile as detailed at 
> [http://mapserver.org/output/tile_mode.html], and actually, it works great! 
> Might be able to avoid the pains of WMS completely.
> 
> However, it works great with MapServer CGI. What if I want to use MapScript? 
> In other words, instead of 
> 
>var urlTemplate = 'http://localhost/cgi-bin/myapp?';
>urlTemplate += 'layers=layer1 layer2&';
>urlTemplate += 'mode=tile&';
>urlTemplate += 'tilemode=gmap&';
>urlTemplate += 'tile={X}+{Y}+{Z}';
> 
> I have
> 
>var urlTemplate = 'http://localhost/myapp.cgi?';
>urlTemplate += 'tile={X}+{Y}+{Z}';
> 
> and I add mode=tile and tilemode=gmap on the server side. My question is -- 
> one, will the above work? and, how do I pass mode=tile and tilemode=gmap and 
> the tile={X}+{Y}+{Z} parameters to the program? I didn't see any MapScript 
> documentation for these parameters. I need to translate a call such as 
> [http://localhost/cgi-bin/myapp?layers=layer1&mode=tile&tilemode=gmap&tile=30+46+7]
>  into a MapScript request.
> 
> Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] updating docs

2011-09-10 Thread Mr. Puneet Kishor
I would like to contribute some of my experiences and revelations to the 
MapScript docs on the mapserver.org. How do I go about doing 
that?___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] updating docs

2011-09-10 Thread Mr. Puneet Kishor

On Sep 10, 2011, at 8:48 AM, Jeff McKenna wrote:

> On 11-09-10 10:11 AM, Mr. Puneet Kishor wrote:
>> I would like to contribute some of my experiences and revelations to the 
>> MapScript docs on the mapserver.org. How do I go about doing 
>> that?___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
> 
> Hi Puneet!
> 
> Sounds good.  Which doc are you thinking of?


Several -- the `mode=tile` page, and various, complete, working Perl MapScript 
examples and hints, etc.



> Also: the very easiest way to improve docs is to write all of your examples, 
> notes, hints, advice, on a wiki page (such as 
> http://trac.osgeo.org/mapserver/wiki/PHPMapScript).


Hmmm... I didn't even realize there was a wiki. I guess, most folks, like me, 
tend to go to the main docs, and kinda stay around there.


> 
> -jeff
> 
> -- 
> Jeff McKenna
> MapServer Consulting and Training Services
> http://www.gatewaygeomatics.com/
> 
> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] querying in mode=tile

2011-09-10 Thread Mr. Puneet Kishor
Now that I have mode=tile working with Google Maps API v3, I am on my way to 
implement querying like so

0. Bind an infowindow.close() to a click event listener on the map
1. Bind an infowindow.open() to a click event listener on the MapServer 
layer
2. Fill the infowindow content with the result from an Ajax query to 
MapServer
3. When the user clicks on the MapServer layer, the Ajax query is fired
4. MapServer responds with the query result as a JSON object
5. Fill the infowindow with the JSON result
6. Close any already open infowindow via #0 above
7. Open a new infowindow with the result

Is the general approach outlined above sound? Any pointers to existing code 
samples for the above?

Tia.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] querying with mode=tile

2011-09-10 Thread Mr. Puneet Kishor
I am still struggling with querying with mode=tile. 

My layer definition is

  LAYER
CLASSITEM "foo"
CONNECTION "host=localhost port=5432 dbname=db user=user password=password"
CONNECTIONTYPE POSTGIS
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "the_geom FROM a_view USING UNIQUE gid USING srid=4326"
NAME "layer"

PROJECTION
  "init=epsg:4326"
END

STATUS ON
TYPE POLYGON
TEMPLATE '/path/to/template.json'

 # lots of CLASS definitions
CLASS
  ..
END
  END # LAYER "layer"

The "template.json" file looks like so

  // mapserver template
  [resultset layer=layer]
  {
"type": "FeatureCollection",
"features": [
  [feature trimlast=',']
  {
"attrib1": "[attrib1]",
"attrib2": "[attrib2]",
"attrib3": "[attrib3]"
  },
  [/feature]
]
  }
  [/resultset]

My query looks like so

  
http://localhost/cgi-bin/app?layers=layer&mode=query&img.x=430&img.y=375&imgext=59.781131+96.2920453+69.171756+91.588920

Issue 1: I really do have a feature at the point I clicked, yet I get no 
result. It is likely my query is ill-formed. Truth be told, I don't know the 
complete list of params that `mode=query` takes, and I can't really find a 
single place in the documentation where this information is available. One, 
could someone tell me what is wrong with my query above? Two, point me to the 
relevant documentation. Maybe I just don't know how to find the correct 
documentation.

Issue 2: Because MapServer finds no result, it reports back as 
"msQueryByPoint(): Search returned no results. No matching record(s) found." 
Well, no... what I really want is an empty JSON stream.

In reality, I am sending the above query via Google Maps (which is why it is 
likely I have the wrong params, or wrong value for the right params) in my 
query. Once again, I would really appreciate hearing from someone who has 
solved this problem already. Specifically, I need to query from Google Maps API 
v3 to a MapServer backend running `mode=tile`

Oh, and I still want to know if I can run the MapServer backend as a MapScript 
using `mode=tile` instead of CGI.

Sadly, if I am unable to solve this, I will have to abandon MapServer and look 
at other options for this project, but I hope it won't come to that.

Many thanks,

Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] querying with mode=tile

2011-09-10 Thread Mr. Puneet Kishor

On Sep 10, 2011, at 9:42 PM, Prabu Raja wrote:

> Try this,
> 
> http://localhost/cgi-bin/app?layers=layer&mode=query&mapxy=lng+lat
> 
> where lng = clicked longitude
>  lat = clicked latitude
> 
> working for me.


Neat! it does work. Many thanks. 


Where did you find this information? Could you please point me to the location 
in the documentation where I could read up on this?



> 
> On Sun, Sep 11, 2011 at 6:58 AM, Mr. Puneet Kishor wrote:
> 
>> 
>> http://localhost/cgi-bin/app?layers=layer&mode=query&img.x=430&img.y=375&imgext=59.781131+96.2920453+69.171756+91.588920
>> 
> 
> 
> 
> -- 
> Regards,
> Prabu Raja

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] querying with mode=tile

2011-09-10 Thread Mr . Puneet Kishor
Couple of follow-ups (the following hint from Prabu Raja does work) --

If I change the name of the template from "template.html" to "template.json" I 
get the following error

Content-type: text/html msReturnPage(): Web application error. Malformed 
template name (/Users/punkish/Documents/www/gmaps/lib/template.json).

Another issue -- my template looks like so --

// mapserver template
[resultset layer=layer]
{
  "type": "FeatureCollection",
  "features": [
[feature trimlast=',']
{
  "attrib1": "[attrib1]",
  "attrib2": "[attrib2]",
  "attrib3": "[attrib2]"
},
[/feature]
  ]
}
[/resultset]

When the above does work, I get back the following --

{ "type": "FeatureCollection", "features": [ { "attrib1": "foo", "attrib2": 
"bar", "attrib3": "baz" }, ] }

Hmmm... what's with that last "," after the first element in the features 
array? From what it seems like, I thought the [feature trimlast=','] would get 
rid of the last comma. 


On Sep 10, 2011, at 9:52 PM, Mr. Puneet Kishor wrote:

> 
> On Sep 10, 2011, at 9:42 PM, Prabu Raja wrote:
> 
>> Try this,
>> 
>> http://localhost/cgi-bin/app?layers=layer&mode=query&mapxy=lng+lat
>> 
>> where lng = clicked longitude
>>     lat = clicked latitude
>> 
>> working for me.
> 
> 
> Neat! it does work. Many thanks. 
> 
> 
> Where did you find this information? Could you please point me to the 
> location in the documentation where I could read up on this?
> 
> 
> 
>> 
>> On Sun, Sep 11, 2011 at 6:58 AM, Mr. Puneet Kishor 
>> wrote:
>> 
>>> 
>>> http://localhost/cgi-bin/app?layers=layer&mode=query&img.x=430&img.y=375&imgext=59.781131+96.2920453+69.171756+91.588920
>>> 
>> 
>> 
>> 
>> -- 
>> Regards,
>> Prabu Raja
> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] querying with mode=tile

2011-09-10 Thread Mr. Puneet Kishor

On Sep 10, 2011, at 10:03 PM, Prabu Raja wrote:

> http://mapserver.org/cgi/controls.html?highlight=mapxy
> 


Thanks Prabu.


To the MapServer developers/documenters --

On the page provided above, I note 5 instances of "mapxy". Only the following 
one is vaguely indicative of being useful in queries because of the last three 
words "User with queries."

"MAPXY [x] [y] , MAPXY (shape)
A point, in the same coordinate system as the shapefiles, to be used in 
conjuction with a buffer or a scale to construct a map extent.
Can be set to shape as an alternative option. In this case mapextent is set to 
the extent of a selected shape. Used with queries."



I am curious as to how I could have figured out that mode=query combined with 
mapxy=lng+lat would have been sufficient for querying by point? I do genuinely 
want to know.



Additionally, just below that MAPXY entry, there is the write-up no MODEs. 
Granted, the text warns that "note that all of the query modes also support 
map-only modes, e.g. ITEMQUERYMAP, which for brevity are not all listed," where 
would I read up on mode=tile other than at 
[http://mapserver.org/output/tile_mode.html], the latter page strangely saying 
that it is revision 9817 updated on 

> Date: $Date: 2010-02-20 11:35:53 -0800 (Sat, 20 Feb 2010) $
> Last Updated: 2008/04/30

H...




> On Sun, Sep 11, 2011 at 8:22 AM, Mr. Puneet Kishor wrote:
> 
>> 
>> On Sep 10, 2011, at 9:42 PM, Prabu Raja wrote:
>> 
>>> Try this,
>>> 
>>> http://localhost/cgi-bin/app?layers=layer&mode=query&mapxy=lng+lat
>>> 
>>> where lng = clicked longitude
>>> lat = clicked latitude
>>> 
>>> working for me.
>> 
>> 
>> Neat! it does work. Many thanks.
>> 
>> 
>> Where did you find this information? Could you please point me to the
>> location in the documentation where I could read up on this?
>> 
>> 
>> 
>>> 
>>> On Sun, Sep 11, 2011 at 6:58 AM, Mr. Puneet Kishor >> wrote:
>>> 
>>>> 
>>>> 
>> http://localhost/cgi-bin/app?layers=layer&mode=query&img.x=430&img.y=375&imgext=59.781131+96.2920453+69.171756+91.588920
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Regards,
>>> Prabu Raja
>> 
>> 
> 
> 
> -- 
> Regards,
> Prabu Raja

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] JSON template fail

2011-09-10 Thread Mr. Puneet Kishor
I was unable to achieve success with the suggestion for template at 
[http://mapserver.org/output/template_output.html]. So, I simplified my 
template like so --

// mapserver template
{
  "gid": "[gid]",
  "attrib1": "[attrib1]",
  "attrib2": "[attrib2]",
  "attrib3": "[attrib3]"
}

In my map file I have an output format declared like so

OUTPUTFORMAT
  NAME "json"
  DRIVER "TEMPLATE"
  MIMETYPE "application/json"
  FORMATOPTION "FILE=/Users/punkish/Documents/www/gmap/lib/template.html"
END

Note: MapServer croaks if I name the template "template.json"

The output from MapServer is 

1: {
2:  "gid": "2676",
3:  "attrib1": "foo",
4:  "attrib2": "bar",
5:  "attrib3": "baz"
6: }

gmap:-1 Resource interpreted as Script but transferred with MIME type text/html.
gmap:2 SyntaxError: Parse error

So, in spite of declaring the MIMETYPE as "application/json", the result is 
sent back with a "text/html" mime type (could that be because the template ends 
in .html?). And, what on earth is the "SyntaxError"? I don't see any. Does 
anyone?


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] interesting thread on JSON-ish output from MapServer

2011-09-10 Thread Mr. Puneet Kishor
[http://osgeo-org.1803224.n2.nabble.com/GeoJSON-output-from-MapServer-td3188987.html]

If I call my template "template.html" I get the output, but I get mime type 
warning and a syntax error in parsing the output.

If I rename the template "template.json" MapServer complains that the name is 
malformed.

If I rename the template "template.js" MapServer complains that it is "Unable 
to access file"

If I add `qformat=geojson` to my query (as shown in the link above), the output 
contains the template with the place holders, no substitutions with the values.

What gives?___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Leaflet and MapServer

2011-09-10 Thread Mr. Puneet Kishor
Has anyone got Leaflet working with MapServer `mode=tile`? While Leaflet also 
sends X, Y, Z (in a different order than Gmaps), its tile numbers are way 
different from those generated by 
Gmaps.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: interesting thread on JSON-ish output from MapServer

2011-09-11 Thread Mr . Puneet Kishor
Partial solution (phew, for now), but other problems persist --

(cc-ing to Steve Lime and Rich Greenwood)

On Sep 10, 2011, at 11:42 PM, Mr. Puneet Kishor wrote:

> [http://osgeo-org.1803224.n2.nabble.com/GeoJSON-output-from-MapServer-td3188987.html]
> 
> If I call my template "template.html" I get the output, but I get mime type 
> warning and a syntax error in parsing the output.

The above is now partially solved. I still get the mime type incorrectly set, 
but the syntax error was my mistake. However, it is something worthy of being 
documented. I was making a JSONP (cross-domain) call. Hence, the response 
coming back should have been wrapped in the callback as an argument. Since I am 
stuck using CGI for now, I don't know if I can get MapServer to recognize the 
callback param that is randomly generated by jQuery, and use that in the 
template. So, I prescribed a custom callback, and used that in the template.

Before (doesn't work with JSONP)
-
$.ajax({
url : url,
type: "GET",
data: "",
dataType: "jsonp",
error   : function() { alert("Error loading html document"); },
success : function(r) { .. }
});

// mapserver template
{"gid":"[gid]","unit":"[unit_abbre]","rock 
type":"[rocktype]","lithology":"[lithology]","min age":"[min_age]","max 
age":"[max_age]","interval":"[interval_name]"}

After (works fine, note addition of "jsonpCallback" in the request)
---
$.ajax({
url : url,
type: "GET",
data: "",
dataType: "jsonp",
jsonpCallback: "foo",
error   : function() { alert("Error loading html document"); },
success : function(r) { .. }
});

// mapserver template
foo({"gid":"[gid]","unit":"[unit_abbre]","rock 
type":"[rocktype]","lithology":"[lithology]","min age":"[min_age]","max 
age":"[max_age]","interval":"[interval_name]"})


One issue I have not solved -- if no result is found, MapServer sends back the 
following --




MapServer Message





msQueryByPoint(): Search returned no results. No matching record(s) found.





Well, that gums up the works. I really want MapServer to just send an empty 
JSON structure, something like foo({}). Suggestions on how I can prevent this 
HTML message from MapServer, and force it to use the template instead?


> 
> If I rename the template "template.json" MapServer complains that the name is 
> malformed.


This one is interesting. Per Steve Lime's email earlier today, "Issue 1: only 
certain extensions can be used for templates. I believe .js is legal but .json 
is not. We could change that in future releases. Could you file a ticket?" Yet, 
the docs at [http://mapserver.org/output/template_output.html] very clearly 
mention the use of ".json" as a file extension. I quote

> OUTPUTFORMAT
>   NAME "geojson"
>   DRIVER "TEMPLATE"
>   FORMATOPTION "FILE=myTemplate.json"
> END


Fwiw, I using `NAME "geojson"` as above in my `OUTPUTFORMAT` block, but I am 
returning just plain vanilla JSON. If I change the "NAME" to "json", I get back 
an unprocessed template.

> 
> If I rename the template "template.js" MapServer complains that it is "Unable 
> to access file"

".js" being legal notwithstanding, the fact is, if I change my template.html to 
template.js, MapServer errors with the above complaint "Unable to access file," 
whatever that means. Exactly the same file, same file mode, everything 
identical, just the name change.


> If I add `qformat=geojson` to my query (as shown in the link above), the 
> output contains the template with the place holders, no substitutions with 
> the values.

This is even more bizarre -- per the email thread at 
[[http://osgeo-org.1803224.n2.nabble.com/GeoJSON-output-from-MapServer-td3188987.html],
 it seems from Steve's comment that `qformat=geojson` is a valid query param 
(although I don't see it documented anywhere). Yet, if I add that, I get an 
unprocessed template.


> 
> What gives?

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] interesting thread on JSON-ish output from MapServer

2011-09-11 Thread Mr. Puneet Kishor

On Sep 11, 2011, at 7:58 AM, Richard Greenwood wrote:

> On Sat, Sep 10, 2011 at 10:42 PM, Mr. Puneet Kishor  
> wrote:
>> [http://osgeo-org.1803224.n2.nabble.com/GeoJSON-output-from-MapServer-td3188987.html]
>> 
>> If I call my template "template.html" I get the output, but I get mime type 
>> warning and a syntax error in parsing the output.
> 
> Where is the warning originating? I have no problem consuming
> mapserver template based JSON in jQuery, despite the incorrect mime
> type. I do not know of any way to set the mime type of a mapserver
> template.
> 

I solved that one. See my recent email on the lack of JSONP callback in the 
template being the culprit. This is another in the list of items that I would 
like to add to MapServer documentation.

Re. setting mime type of MapServer templates, ostensibly you can in the 
OUTPUTFORMAT block. For example, I have the following

OUTPUTFORMAT
  NAME "geojson"
  DRIVER "TEMPLATE"
  MIMETYPE "application/json"
  FORMATOPTION "FILE=/Users/punkish/Documents/www/gmaps/lib/gmna.html"
END

Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] querying in mode=tile

2011-09-11 Thread Mr. Puneet Kishor

On Sep 11, 2011, at 8:03 AM, Richard Greenwood wrote:

> On Sat, Sep 10, 2011 at 1:35 PM, Mr. Puneet Kishor  
> wrote:
>> Now that I have mode=tile working with Google Maps API v3, I am on my way to 
>> implement querying like so
>> 
>>0. Bind an infowindow.close() to a click event listener on the map
>>1. Bind an infowindow.open() to a click event listener on the MapServer 
>> layer
>>2. Fill the infowindow content with the result from an Ajax query to 
>> MapServer
>>3. When the user clicks on the MapServer layer, the Ajax query is fired
>>4. MapServer responds with the query result as a JSON object
>>5. Fill the infowindow with the JSON result
>>6. Close any already open infowindow via #0 above
>>7. Open a new infowindow with the result
>> 
>> Is the general approach outlined above sound? Any pointers to existing code 
>> samples for the above?
> 
> 
> Puneet,
> 
> I'm doing pretty much that here:
>   http://records.sublettewyo.com/mapserver/map.html
> I'm using jQuery in this example and putting the info into a jQuery
> dialog, however I have used a standard browser window in the past.
> Only thing is that I don't thinnk you really need step 0, simply
> replace the contents of the container with the new info.


Yup, I don't have to worry about #0. Howerver, #1 above is problematic, and I 
don't have a resolution for it yet. Seems like in Google Maps API v3 I can't 
addListener to an ImageMapType overlay. See, I am adding a MapServer layer as 
ImageMapType overlay like so

  "mapserverLayer" : new google.maps.ImageMapType({ .. })
  map.overlayMapTypes.insertAt(0, mapserverLayer);


If I do the following --

  google.maps.event.addListener(map, "click", function (event) { }

it works, however, the following doesn't work at all

  google.maps.event.addListener(mapserverLayer, "click", function (event) { }

Which is silly, isn't it? I don't want the entire map to be listening to the 
"click" events. I just want the MapServer layer to be doing so. Haven't yet 
found a resolution to this.


> 
> Also, if your data is in PostGIS you can skip mapserver for attribute
> queries and do an info query against the PostGIS db via PHP or other
> server-side tool.
> 

Ok, I am very interested in the above, but I am not sure I understand you. For 
the most part, I want to click on the map, and find out more about what I 
clicked on. In order to do that query via Perl MapScript (I don't know PHP) and 
Pg, I would need to create the $mapObj. I am able to do that fine, but I don't 
know how to run MapServer in `mode=tile` via MapScript. This is the question I 
have asked a couple of times -- if I have a pure MapScript app (no map files 
involved at all, which is what I want), how no earth do I tell the app to use 
`mode=tile`?

Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] bad query result crashes Perl

2011-09-11 Thread Mr. Puneet Kishor
I query Pg to grab the data with which I construct LAYER CLASSes like so 
(nothing fancy).

SELECT class_name, class_expression, class_color FROM table;

A few of the rows in the result set come back with class_color = '' (I can 
easily avoid those, but that is not the point of this post). The "bad" color 
crashes mapscript.bundle which takes down Perl as well, which should never 
happen.

I am using Perl 5.14.1 on Mac OS X Lion.

$ perl -V
Summary of my perl5 (revision 5 version 14 subversion 1) configuration:
   
  Platform:
osname=darwin, osvers=11.0.1, archname=darwin-multi-2level
uname='darwin lucknow.local 11.0.1 darwin kernel version 11.0.1: wed jun 29 
19:53:22 pdt 2011; root:xnu-1699.23.2~1release_x86_64 x86_64 
..
blah blah
..

Here is the crash report



Process: perl5.14 [247]
Path:/opt/local/bin/perl5.14
Identifier:  perl5.14
Version: ??? (???)
Code Type:   X86-64 (Native)
Parent Process:  perl5.14 [246]

Date/Time:   2011-09-11 11:25:29.138 -0500
OS Version:  Mac OS X 10.7.1 (11B2118)
Report Version:  9

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x

VM Regions Near 0:
--> 
__TEXT 00010ca28000-00010cb6a000 [ 1288K] r-x/rwx 
SM=COW  /opt/local/bin/perl5.14

Application Specific Information:
objc[247]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   mapscript.bundle0x00010cdd2e84 
_wrap_styleObj_color_set + 596


--
Puneet Kishor ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: interesting thread on JSON-ish output from MapServer

2011-09-11 Thread Mr. Puneet Kishor

On Sep 11, 2011, at 12:46 PM, Steve Lime wrote:

> 
> 
> Sent from my iPad
> 
> On Sep 11, 2011, at 9:36 AM, Mr. Puneet Kishor  wrote:
> 
>> Partial solution (phew, for now), but other problems persist --
>> 

..

>> 
>> 
>> One issue I have not solved -- if no result is found, MapServer sends back 
>> the following --
>> 
>> 
>> 
>> 
>> MapServer Message
>> 
>> 
>> 
>> 
>> 
>> msQueryByPoint(): Search returned no results. No matching record(s) found.
>> 
>> 
>> 
>> 
>> 
>> Well, that gums up the works. I really want MapServer to just send an empty 
>> JSON structure, something like foo({}). Suggestions on how I can prevent 
>> this HTML message from MapServer, and force it to use the template instead?


Any suggestion for the above? That is, force MapServer to not send back an 
error message of the above kind. Instead, send back an empty JSON structure 
based on the template?


Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: interesting thread on JSON-ish output from MapServer

2011-09-11 Thread Mr . Puneet Kishor

On Sep 11, 2011, at 4:18 PM, Steve Lime wrote:

> You could try the web object and the empty parameter.


From TFM

EMPTY [url]
URL to forward users to if a query fails. If not defined the value for ERROR is 
used.


H... I am not sure I want to forward the user to any URL. This is all Ajax, 
so I have to receive an empty data structure. I guess I could try exploiting 
the jQuery `$.ajax({ error: function() { popup an infowindow with regrets 
message } });`




> 
> Sent from my iPad
> 
> On Sep 11, 2011, at 1:33 PM, "Mr. Puneet Kishor"  wrote:
> 
>> 
>> On Sep 11, 2011, at 12:46 PM, Steve Lime wrote:
>> 
>>> 
>>> 
>>> Sent from my iPad
>>> 
>>> On Sep 11, 2011, at 9:36 AM, Mr. Puneet Kishor  wrote:
>>> 
>>>> Partial solution (phew, for now), but other problems persist --
>>>> 
>> 
>> ..
>> 
>>>> 
>>>> 
>>>> One issue I have not solved -- if no result is found, MapServer sends back 
>>>> the following --
>>>> 
>>>> 
>>>> 
>>>> 
>>>> MapServer Message
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> msQueryByPoint(): Search returned no results. No matching record(s) found.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Well, that gums up the works. I really want MapServer to just send an 
>>>> empty JSON structure, something like foo({}). Suggestions on how I can 
>>>> prevent this HTML message from MapServer, and force it to use the template 
>>>> instead?
>> 
>> 
>> Any suggestion for the above? That is, force MapServer to not send back an 
>> error message of the above kind. Instead, send back an empty JSON structure 
>> based on the template?
>> 
>> 
>> Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] layer data sources more than one

2011-09-11 Thread Mr. Puneet Kishor

On Sep 11, 2011, at 9:05 PM, JIAJIA WANG wrote:

> The data in the shapefile are suburb boundaries, but I got several
> shapefiles, one shapefile for one state. I want a map showing the whole
> country's suburb boundaries.
> That's can be done by defining several layers (one layer reads one
> shapefile) in one mapfile. But actually there are not conflicts between
> these shapefiles. So I want to know is there any way to define only one
> layer and read the data from all these shapefiles.


I am pretty sure (but not 100%) that you can have only one data source per 
layer. That said, you could either combine all the shapefiles into a single 
countrywide shapefile, or you could create separate layers, and then create a 
layer group (I am pretty sure you can group the layers into one... its been a 
long time, and I am just coming back to MapServer, so check the docs). That 
way, all the different layers for different states will behave as if they are a 
single layer. From the docs --

GROUP [name]
  Name of a group that this layer belongs to. The group name can then be 
reference as a regular 
  layer name in the template files, allowing to do things like turning on and 
off a group of 
  layers at once.

> 
> On Mon, Sep 12, 2011 at 11:17 AM, Mr. Puneet Kishor 
> wrote:
> 
>> 
>> On Sep 11, 2011, at 8:10 PM, jjwang wrote:
>> 
>>> Hi,
>>> 
>>> I know that the DATA statement should be given a data source of the
>> layer.
>>> What if the data comes from multi shapefiles?
>>> Can I give it a list of shapefiles and how to write it?
>>> 
>> 
>> 
>> Generally a LAYER maps to a shapefile or a table in a db. It is hard for me
>> to imagine how one layer could have data from two or more shapefiles.
>> Perhaps more explanation would help here.
>> 
>> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] querying in mode=tile

2011-09-11 Thread Mr. Puneet Kishor

On Sep 11, 2011, at 10:03 PM, Richard Greenwood wrote:

> On Sun, Sep 11, 2011 at 8:48 AM, Mr. Puneet Kishor  
> wrote:
>> 
>> On Sep 11, 2011, at 8:03 AM, Richard Greenwood wrote:
>> 
>>> On Sat, Sep 10, 2011 at 1:35 PM, Mr. Puneet Kishor  
>>> wrote:
>>>> Now that I have mode=tile working with Google Maps API v3, I am on my way 
>>>> to implement querying like so
>>>> 
>>>>0. Bind an infowindow.close() to a click event listener on the map
>>>>1. Bind an infowindow.open() to a click event listener on the MapServer 
>>>> layer
>>>>2. Fill the infowindow content with the result from an Ajax query to 
>>>> MapServer
>>>>3. When the user clicks on the MapServer layer, the Ajax query is fired
>>>>4. MapServer responds with the query result as a JSON object
>>>>5. Fill the infowindow with the JSON result
>>>>6. Close any already open infowindow via #0 above
>>>>7. Open a new infowindow with the result
>>>> 
>>>> Is the general approach outlined above sound? Any pointers to existing 
>>>> code samples for the above?
>>> 
>>> 
>>> Puneet,
>>> 
>>> I'm doing pretty much that here:
>>>   http://records.sublettewyo.com/mapserver/map.html
>>> I'm using jQuery in this example and putting the info into a jQuery
>>> dialog, however I have used a standard browser window in the past.
>>> Only thing is that I don't thinnk you really need step 0, simply
>>> replace the contents of the container with the new info.
>> 
>> 
>> Yup, I don't have to worry about #0. Howerver, #1 above is problematic, and 
>> I don't have a resolution for it yet. Seems like in Google Maps API v3 I 
>> can't addListener to an ImageMapType overlay. See, I am adding a MapServer 
>> layer as ImageMapType overlay like so
>> 
>>  "mapserverLayer" : new google.maps.ImageMapType({ .. })
>>  map.overlayMapTypes.insertAt(0, mapserverLayer);
>> 
>> 
>> If I do the following --
>> 
>>  google.maps.event.addListener(map, "click", function (event) { }
>> 
>> it works, however, the following doesn't work at all
>> 
>>  google.maps.event.addListener(mapserverLayer, "click", function (event) { }
>> 
>> Which is silly, isn't it? I don't want the entire map to be listening to the 
>> "click" events. I just want the MapServer layer to be doing so. Haven't yet 
>> found a resolution to this.
>> 
>> 
>>> 
>>> Also, if your data is in PostGIS you can skip mapserver for attribute
>>> queries and do an info query against the PostGIS db via PHP or other
>>> server-side tool.
>>> 
>> 
>> Ok, I am very interested in the above, but I am not sure I understand you. 
>> For the most part, I want to click on the map, and find out more about what 
>> I clicked on. In order to do that query via Perl MapScript (I don't know 
>> PHP) and Pg, I would need to create the $mapObj. I am able to do that fine, 
>> but I don't know how to run MapServer in `mode=tile` via MapScript. This is 
>> the question I have asked a couple of times -- if I have a pure MapScript 
>> app (no map files involved at all, which is what I want), how no earth do I 
>> tell the app to use `mode=tile`?
>> 
>> Puneet.
>> 
>> 
> 
> Puneet,
> 
> I do not know how to bind an infowindow.open() to a click event
> listener on the MapServer layer (#1 above) because I do not use the
> Google API. But using Perl, PHP or whatever it is easy to query a
> PostGIS database, and even get GeoJSON back should you want to
> highlight the selected object on the map.
> 
> I am using OpenLayers so I can easily convert the mouse click (or box)
> to a real-world coordinate(s). I pass the point or box to a PHP page
> which connects to a PostGIS db, does the query, and returns JSON. Does
> that help? I'm not sure that I understand everything that you're doing
> and maybe my approach is not appropriate in your case.


I am assuming you are using OL with MapServer WMS. If I could get MapServer WMS 
(via MapScript) working, it would have been good, but after screwing around for 
a day and a half unsuccessfully, I gave up (for now).

Then I tried `mode=tile` and it just worked. However, even that is not fully 
satisfactory as it is not via MapScript. Without MapScript I am severely 
hampered -- the complexity of the datasets makes for beastly map files. My map 
file with just

Re: [mapserver-users] querying in mode=tile

2011-09-11 Thread Mr. Puneet Kishor

On Sep 11, 2011, at 10:52 PM, Richard Greenwood wrote:

> On Sun, Sep 11, 2011 at 9:37 PM, Mr. Puneet Kishor  
> wrote:
> 
>> However, since I am not using MapScript (even though I would prefer to), I 
>> would have to implement both CGI and MapScript to do what you are suggesting 
>> above -- CGI to display the map and MapScript to do the query.
> 
> But my point was that you can do the query without mapserver at all if
> the data is in postgis. Use a server-side language such as Perl or PHP
> to pass the request to postgis, which can do a spatial query, and then
> Perl or PHP can format the result as JSON and return it to the page
> (via AJAX).


On second reading, I now get what you are saying. Strange that it never 
occurred to me. Sounds very sensible, and I will implement it tomorrow. That 
way I can get away from CGI `mode=query` and its TEMPLATE-ing vagaries. Yes, my 
data are in Pg, so I can do all my querying with Perl.

Wish I could do away with `mode=tile` and also get tiles back via MapScript. 
Then my solution would be complete.

Thanks for this really useful hint (more like making me see the obvious that I 
was missing for some reason).

Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] recommended tile caching mechanism with `mode=tile`

2011-09-17 Thread Mr. Puneet Kishor
I am using MapServer cgi with `mode=tile` with a Google Maps front-end, and am 
wondering what is a recommended tile cache server.

Any suggestions from personal experience?

--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] recommended tile caching mechanism with `mode=tile`

2011-09-18 Thread Mr. Puneet Kishor

On Sep 17, 2011, at 11:43 PM, Daniel Morissette wrote:

> On 11-09-18 12:08 AM, Mr. Puneet Kishor wrote:
>> I am using MapServer cgi with `mode=tile` with a Google Maps front-end, and 
>> am wondering what is a recommended tile cache server.
>> 
>> Any suggestions from personal experience?
>> 
> 
> MapServer MapCache of course! It is a fully featured, robust and fast tiling 
> server. Only available in MapServer SVN trunk at the moment.
> 
> http://mapserver.org/trunk/mapcache/
> 
> It was formerly known as Mod-Geocache until a few weeks ago... the website is 
> in the process of being migrated to the above URL, but in the meantime you 
> can still reach the old site:
> 
> http://code.google.com/p/mod-geocache/
> 


Very nice. I look forward to installing this; hopefully, it will be 
straightforward.

A couple of questions -- 

1. I was looking at mod_cache (mod_disk_cache and mod_mem_cache) yesterday and 
wondering if they could be used to cache the images. Is mod_geocache 
inspired/based on those modules?

2. Why wed this to Apache? By making it web-server agnostic, you open up the 
audience.


Puneet.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] installing and configuring mapcache

2011-09-18 Thread Mr. Puneet Kishor
installation mostly went well except for pixman. The install docs say, I should 
have the following incantation

--with-pixman=[yes|no|/path/to/pkgconfig/pixman.pc]

I installed pixman and have the following

$ll /opt/local/include/pix*
total 88
-rw-r--r--  1 root  admin   1739 Sep 18 11:35 pixman-version.h
-rw-r--r--  1 root  admin  39608 Sep 18 11:35 pixman.h

$ll /opt/local/lib/libpix*
-rwxr-xr-x  1 root  admin  474024 Sep 18 11:35 
/opt/local/lib/libpixman-1.0.22.2.dylib*
lrwxr-xr-x  1 root  admin  24 Sep 18 11:35 
/opt/local/lib/libpixman-1.0.dylib@ -> libpixman-1.0.22.2.dylib
-rw-r--r--  1 root  admin  550432 Sep 18 11:35 /opt/local/lib/libpixman-1.a
lrwxr-xr-x  1 root  admin  24 Sep 18 11:35 
/opt/local/lib/libpixman-1.dylib@ -> libpixman-1.0.22.2.dylib
-rwxr-xr-x  1 root  admin 866 Sep 18 11:35 /opt/local/lib/libpixman-1.la*


I am not sure where I would find this pitman.pc. I tried configure-ing with 
`--with-pixman=/opt/local` but no luck. Suggestions on how I could include 
pixman?

Anyway, in the meantime, I dropped pixman support and configured successfully. 
`make` and `sudo make install-module` added the module to my httpd.conf. But, 
now I am lost again. Per the docs

---
Next, a geocache configuration is mapped to the server url with the following 
snippet



   Order Allow,Deny
   Allow from all

GeoCacheAlias /geocache "/path/to/directory/geocache.xml"

---

I can't really parse the above. What is the `path/to/directory` in ? I have the `geocache.xml` in my mapcache src tree; Should I place it 
somewhere special? Is this `path/to/directory` where the tiles are stored?

And, finally, what should I do if I have the following mapserver URL where 
tile.x, tile.y and zoom are inserted dynamically?

http:///cgi-bin/mapcgi?layers=layer&mode=tile&tilemode=mapcgi&tile=' + 
tile.x + '+' + tile.y + '+' + zoom

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] installing and configuring mapcache

2011-09-18 Thread Mr. Puneet Kishor

On Sep 18, 2011, at 1:48 PM, thomas bonfort wrote:
>> I am not sure where I would find this pitman.pc. I tried configure-ing with 
>> `--with-pixman=/opt/local` but no luck. Suggestions on how I could include 
>> pixman?
> 
> /opt/local/lib/pkgconfig/pixman-1.pc

Thanks, that worked, and compiled cleanly.


>> And, finally, what should I do if I have the following mapserver URL where 
>> tile.x, tile.y and zoom are inserted dynamically?
>> 
>> http:///cgi-bin/mapcgi?layers=layer&mode=tile&tilemode=mapcgi&tile=' 
>> + tile.x + '+' + tile.y + '+' + zoom
> 
> you have to give the url to the *wms* service, not the tile one, i.e.
> http:///cgi-bin/mapcgi?map=foo.map


h... I am using Google Maps API v3, and haven't implemented a WMS tiling 
front-end and MapServer WMS backend that would support that. Which is why when 
I started the earlier thread inquiring about caching mechanisms, I specifically 
inquired for ones that supported MapServer's `mode=tile`, else I would have 
explored tilecache.org or geowebcache.

So, now I would have to modify my frontend, and configure MapServer as WMS, 
before I can test mod-geocache. Will be a while, it seems.

Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] efficiently displaying daily changing vector data

2011-09-20 Thread Mr. Puneet Kishor
I have just finished reading the following thread

Mapserver - User - How to display vector symbols (direction and magnitude) in 
MapServer?
http://osgeo-org.1803224.n2.nabble.com/How-to-display-vector-symbols-direction-and-magnitude-in-MapServer-td1971531.html


Two questions --

1. What is the most efficient way to display vector data that comes to me on a 
daily basis as text files. I have x,y, length and angle information in these 
text files (along with some other info). I guess, I will have to massage the 
files to convert them to clean CSV with only the first line containing the 
column names. Then I can access the file as an OGRVRTDataSource. Or, should I 
insert the data in a Pg table and then use that? The files will be refreshed 
daily, so the processing needs to be done only once a day.

2. The thread above makes a mention of a Mapfile CLASS definition like so

  CLASS
 SYMBOL 'arrow' 
 ANGLE [Rate] 
 SIZE [Az] 
 COLOR 0 0 0
  END

Is there an arrow symbol definition that I can use, or is that only possible 
with truetype fonts?___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] little whiskers on my arrows

2011-09-21 Thread Mr. Puneet Kishor
I have a simple arrowhead defined like soSTYLE    SYMBOL 'horiz-line'     ANGLE [Az]     SIZE [Rate]    COLOR 255 255 255    WIDTH 1ENDSTYLE    ANGLE [Az]    GEOMTRANSFORM "end"    SYMBOL "to"    COLOR 255 255 255    WIDTH 8ENDSYMBOL    NAME "horiz-line"    TYPE vector    POINTS        0 0        1 0    ENDENDSYMBOL    NAME "to"    TYPE vector    POINTS        0 0        1 0.5        0 1    ENDENDI have attached two images: arr.png and arr_zoom.png. They show the problem. My arrows have little whiskers coming out from behind the arrowhead. How can I get a clean symbol?Puneet.___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] WMS layers get canceled

2011-09-22 Thread Mr. Puneet Kishor

On Sep 22, 2011, at 11:00 PM, Rahkonen Jukka wrote:

> Hi,
> 
> Is this really your DATA or did you just wipe our "AS" from "AS foo" when 
> editing your mail?

There is no difference between `(SELECT...) AS foo` and `(SELECT...) foo`. `AS` 
is optional in SQL when declaring aliases.

> DATA "the_geom FROM (SELECT gid, a, b, the_geom FROM table) foo USING UNIQUE 
> gid USING srid=4326"
> 
> It really looks like &service=WMS is not compulsory in WMS. Brave programmer 
> who makes a client to leave it out, though, because it would not cost 
> anything to include it and make thing for sure clear for a server.
> 
> -Jukka Rahkonen-
> 
> 
> Lähettäjä: mapserver-users-boun...@lists.osgeo.org 
> [mapserver-users-boun...@lists.osgeo.org] käyttäjän Puneet 
> Kishor [punk.k...@gmail.com] puolesta
> Lähetetty: 23. syyskuuta 2011 5:17
> Vastaanottaja: mapserver-users@lists.osgeo.org
> Aihe: [mapserver-users] WMS layers get canceled
> 
> I am unable to figure this out --
> 
> My app front is Google Maps API v3 with MapServer 6.0.1
> 
> $./mapserv -v
> MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ 
> SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER 
> SUPPORTS=WMS_CLIENT SUPPORTS=GEOS INPUT=POSTGIS INPUT=GDAL INPUT=SHAPEFILE
> 
> The app fires WMS requests that look like so in Firebug and Safari Web 
> Inspector (one per tile)
> 
> http://path/to/server/cgi-bin/app?version=1.1.1&request=GetMap&format=image/png&TRANSPARENT=TRUE&Styles=&SRS=EPSG:4326&Layers=lyr&width=256&height=256&BBOX=-135,40.97989806962013,-90,66.51326044311185
> 
> The status code in Firebug is "Aborted" ("Canceled" in Safari Web Inspector). 
> The ms_error file kicks in the following messages --
> 
> [Thu Sep 22 21:00:55 2011].347078 msWMSLoadGetMapParams(): enabling 
> non-square pixels.
> [Thu Sep 22 21:00:55 2011].347608 msDrawMap(): kicking into non-square pixel 
> preserving mode.
> [Thu Sep 22 21:00:55 2011].347615 msDrawMap(): rendering using outputformat 
> named png24 (AGG/PNG).
> 
> My .map file has the following incantation --
> 
> in the MAP section #
>PROJECTION
>  "init=epsg:4326"
>END
>WEB
>  METADATA
>ows_enable_request "*"
>wms_abstract "blah blah"
>wms_accessconstraints "none"
>wms_title "gpsvecs"
>wms_onlineresource "http://path/to/server/cgi-bin/gpsvecs?";
>wms_srs "EPSG:4326"
>wms_keywordlist "foo,bar"
>wms_enable_request "*"
>  END
>END
> 
> in the LAYER section 
>LAYER
>  NAME "lyr"
>  CONNECTION "host=localhost port=5432 dbname=db user=user 
> password=passwd"
>  CONNECTIONTYPE POSTGIS
>  PROCESSING "CLOSE_CONNECTION=DEFER"
>  DATA "the_geom FROM (SELECT gid, a, b, the_geom FROM table) foo 
> USING UNIQUE gid USING srid=4326"
> 
>  PROJECTION
>"init=epsg:4326"
>  END
> 
>  METADATA
>wms_srs   "EPSG:4326"
>wms_title "lyr"
>wms_abstract "blah blah"
>wms_keywordlist "foo,bar"
>wms_enable_request "*"
>wms_extent "-180 -90 180 90"
>  END
> 
> 
> Suggestions?___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] passing cgi query params to wms layers

2011-09-26 Thread Mr. Puneet Kishor

On Sep 26, 2011, at 11:04 PM, Stephen Woodbridge wrote:

> On 9/26/2011 10:29 PM, Puneet Kishor wrote:
>> I am using OpenLayers as the front-end, requesting a WMS layer from 
>> MapServer that is getting data from Pg. My DATA statement is like so
>> 
>>  DATA "the_geom FROM (SELECT gid, pc, the_geom FROM table) t USING 
>> UNIQUE gid USING srid=4326"
>> FILTER "pc = 'na'"
>> 
>> The above works fine. However, I would like to send the value of "pc" from 
>> OpenLayers (that is another problem that I am experiencing; I have asked on 
>> OL list on how to send query params to WMS layers, but if any of you know 
>> the solution, I would welcome that). In any case, I thought (naively), that 
>> I could change my FILTER statement like so
>> 
>>  FILTER "pc = '[pc]'"
>> 
>> I tried sending a WMS query directly to test the above like so 
>> [http://server/cgi-bin/app?.. blah ..&pc=na] but no joy. Forcing a query 
>> error showed me that MapServer was executing the following
>> 
>>  select .. from (..) t where the_geom&&  GeomFromText(..) and (pc = 
>> '[pc]')
>> 
>> How can I dynamically supply MapServer a filter value?
> 
> Does this doc answer your question?
>  http://mapserver.org/cgi/runsub.html
> 


Yes it does. I had not seen that doc (hence, I was naively trying [var] kinda 
sub). Man, this is hairy shiiite. Maybe I should concentrate on trying to get 
WMS via MapScript working again so I can work within the more familiar and 
comfy environs of the Perl DBI. MapServer is fast as heck and basically "joy to 
the world," but its Pg interface is a foreign world to me.


> This should help from the mapserver side of things. In the OpenLayers side of 
> things you will need to propagate the parameter values into the base URL for 
> the WMS request and get OpenLayers to propagate that change into the layer 
> object.

I see. Thanks for answering this, because this too had me stumped. The so 
called optional JS object that was supposed to pass arbitrary parameters to the 
OL layer constructor wasn't bringing any success. So, essentially, I should 
construct the base URL and then make my WMS layer as usual.


> If you expect the existing map to change when you change the values, then you 
> will need to force OpenLayers to redraw the layer to request a new image or 
> tiles based on the updated parameters.
> 

Yeah, of course. The idea is that the user clicks on the map, and based on the 
location of the click, a new map layer is generated. Hopefully I will have this 
all working soon and be able to show it to the world.

Many thanks Steve (and you too Jukka).


Puneet.


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] arrow head doesn't draw at the end

2011-09-28 Thread Mr. Puneet Kishor

On Sep 28, 2011, at 3:11 AM, Havard Tveite wrote:

> GEOMTRANSFORM end only works for the lines of a line layer.
> Is your layer a line layer?


Sigh. No, my layer is a POINT layer. Where on this page 
[http://mapserver.org/mapfile/style.html] is it documented that GEOMTRANSFORM 
is only for LINE layers? I could be wrong, but nowhere do I see that mentioned.

In other words, is GEOMTRANSFORM simply not working at all because my layer is 
a POINT layer? That would explain why the symbol is not being produced at the 
"end" point of the symbol, even though I have specified GEOMTRANSFORM "end"

Thanks Håvard. I will lose GEOMTRANSFORM from that STYLE definition.
 
> 
> Håvard
> 
> On 9/27/2011 4:48 PM, Puneet Kishor wrote:
>> 
>> On Sep 27, 2011, at 2:18 AM, Havard Tveite wrote:
>> 
>>> Have you seen:
>>> 
>>> http://mapserver.org/mapfile/symbology/construction.html#changing-the-center-of-a-point-symbol
>> 
>> 
>> Yup, seen and read it from end to end until my eyes glazed. Perhaps it is 
>> clear as crystal to the rest of the world, but I can't fathom anything there 
>> applicable to me. I am facing four problems --
>> 
>> 1. As I mentioned below, per the docs, I am supposed to be able to declare 
>> "ANGLE AUTO" in my STYLE definition. That simply does not work for me. I 
>> *have* to declare the angle the same as the angle of the stem of the arrow 
>> "ANGLE [az]" in order to get arrow heads headed in the same direction as the 
>> arrow stems.
>> 
>> 2. From the docs on GEOMTRANSFORM, "end: produces the last point of the 
>> geometry. When used with ANGLE AUTO, it can for instance be used to render 
>> an arrowhead." Well, no... it is *not* producing the *last point of the 
>> geometry* as I understand it. Instead, it is producing the middle point of 
>> the geometry. And it sure as as I can see is not working with ANGLE AUTO 
>> (see #1 above).
>> 
>> 3. I have tried several variations on my arrow head to try shift its center, 
>> but I am failing to translate the information in the above document to be 
>> able to do it correctly.
>> 
>> 4. Perhaps most important: the length of the arrow is varying based on 
>> [rate]. In other words, I want only the stem to be shorter or longer, but 
>> the arrow head to be the same size, and to be at the "end" of the stem 
>> always. In fact, there are instances in which [rate] could be equal to zero. 
>> In those instances I don't want any arrow to be drawn at all.
>> 
>> *** In other words, I want an arrow stem to be as long as the varying 
>> [rate], and if the stem has a length greater than zero then and only then do 
>> I want an arrow head at the end of the stem pointing in the same direction 
>> as the stem. ***
>> 
>> I even tried using a truetype font symbol, but I get no image at all but no 
>> error as well.
>> 
>> I even tried using a SYMBOL of TYPE pixmap pointing to an image of an arrow. 
>> I realize that if I could make that work, it would still be unsatisfactory 
>> because as MapServer would scale my arrow image, it would make the attached 
>> arrow head also larger, and that would look ugly. In any case, I couldn't 
>> get that to work as well... no image at all, but no error as well.
>> 
>> Could be my compilation of MapServer was buggy, but I didn't see any 
>> compilation time errors, and other than the above oddities, it works quite 
>> well.
>> 
>> $./mapserv -v
>> MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ 
>> SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER 
>> SUPPORTS=WMS_CLIENT SUPPORTS=GEOS INPUT=POSTGIS INPUT=GDAL INPUT=SHAPEFILE
>> 
>> I would love to know if my *** objective *** above can be accomplished with 
>> MapServer. If not, I would look at other workaround. I am currently 
>> rendering arrows using OpenLayers vector layer... it works quite well, but 
>> is slow... MapServer is much faster, and could be cached, hence my desire to 
>> use MapServer.
>> 
>> Thanks.
>> 
>> 
>>> 
>>> Håvard Tveite
>>> 
>>> On 9/27/2011 4:12 AM, Puneet Kishor wrote:
 My arrows look like so -->-- instead of >   with declarations like so
 
 SYMBOL
 NAME "vert-line"
 TYPE vector
 POINTS
 0 1
 0 0
 END
 END
 
  SYMBOL
 NAME "up"
 TYPE vector
 POINTS
 0 1
 0.5 0
 1 1
 END
 END
 
 CLASS
 STYLE
 SYMBOL 'vert-line'
 ANGLE [az]
 SIZE [rate]
 COLOR 0 0 0
 WIDTH 1
 END
 STYLE
 SYMBOL "up"
 ANGLE [az]
 SIZE 5
 GEOMTRANSFORM "end"
 COLOR 0 0 0
 END
 END
 
 But, at least the arrow heads are aligned correctly. Because, if I use 
 "ANGLE auto" as prescribed in the doc

Re: [mapserver-users] arrow head doesn't draw at the end

2011-09-28 Thread Mr. Puneet Kishor
Hi luis,

Thanks for helping out. I will try OVERLAYSYMBOL, but from the docs it seems it 
is no different that using two stacked symbols. I did try GAP, but that doesn't 
help at all.

As I mentioned below, I am drawing these points, not unlike the recent thread 
started by Brent on drawing wind barbs. Except, in my case, these are GPS 
sensor readings. The reading values are always 0 or more (actually, they are 
close to 0, but let's say, the really tiny ones are identifiable). The readings 
have two values... rate and azimuth.

The length of the arrows has to be drawn proportional to the rate, and arrows 
have to be pointed toward the azimuth.

First, I don't want arrows on the 0 (or, close to 0) readings but I still want 
to show them. So, I've decided I will just select them out and draw them as a 
separate layer with just dots. Easy.

Now, the ones that are to be drawn with an arrow: the problem I am facing is 
that I want the arrow head at the end of the arrow stem that is of a 
non-predictable length. Even though the docs imply that I can achieve this with 
GEOMTRANSFORM, I have failed to do so. And, of course, just now I learned that 
perhaps that could be because GEOMSTRANSFORM applies *only* to LINE layers.

Seems to me the *only* reasonable way to achieve this would be to have a 
GEOMTRANSFORM kind of capability for POINT layers as well, so that the last (or 
first or whatever... the specified) point of the symbol geometry could be 
decorated with another symbol.

I am open to all kinds of suggestions at this point.


On Sep 28, 2011, at 3:04 AM, luis peinado wrote:

> Hi, just trying to help.
> I used some trick with arrows than maybe can help you with some variation.
> I use mapserver-5.X and the way it worked for me was a LINE type layer using
> a normal class (continous line) with an OVERLAYSYMBOL, using  a ">"
> character.
> Maybe changin some parameters like GAP may be useful to you.
> 
> This is my class on a TYPE LINE layer
> CLASS
> NAME "capa_tub"
> SYMBOL "continous"
> SIZE 2
> COLOR 6 79 167
> OVERLAYSYMBOL "arrow"
> OVERLAYSIZE 30
> OVERLAYCOLOR 6 79 167
> END
> 
> And my continous and arrow are
> 
> SYMBOL
>  NAME "arrow"
>  TYPE TRUETYPE
>  FONT arial
>  CHARACTER '>'
>  FILLED true
>  ANTIALIAS true
>  GAP -100
> END
> 
> SYMBOL
> NAME "continous"
> TYPE ELLIPSE
> POINTS 1 1 END
> END
> 
> Hope it helps.
> Lluís
> 
> 2011/9/27 Puneet Kishor 
> 
>> 
>> On Sep 27, 2011, at 2:18 AM, Havard Tveite wrote:
>> 
>>> Have you seen:
>>> 
>>> 
>> http://mapserver.org/mapfile/symbology/construction.html#changing-the-center-of-a-point-symbol
>> 
>> 
>> Yup, seen and read it from end to end until my eyes glazed. Perhaps it is
>> clear as crystal to the rest of the world, but I can't fathom anything there
>> applicable to me. I am facing four problems --
>> 
>> 1. As I mentioned below, per the docs, I am supposed to be able to declare
>> "ANGLE AUTO" in my STYLE definition. That simply does not work for me. I
>> *have* to declare the angle the same as the angle of the stem of the arrow
>> "ANGLE [az]" in order to get arrow heads headed in the same direction as the
>> arrow stems.
>> 
>> 2. From the docs on GEOMTRANSFORM, "end: produces the last point of the
>> geometry. When used with ANGLE AUTO, it can for instance be used to render
>> an arrowhead." Well, no... it is *not* producing the *last point of the
>> geometry* as I understand it. Instead, it is producing the middle point of
>> the geometry. And it sure as as I can see is not working with ANGLE AUTO
>> (see #1 above).
>> 
>> 3. I have tried several variations on my arrow head to try shift its
>> center, but I am failing to translate the information in the above document
>> to be able to do it correctly.
>> 
>> 4. Perhaps most important: the length of the arrow is varying based on
>> [rate]. In other words, I want only the stem to be shorter or longer, but
>> the arrow head to be the same size, and to be at the "end" of the stem
>> always. In fact, there are instances in which [rate] could be equal to zero.
>> In those instances I don't want any arrow to be drawn at all.
>> 
>> *** In other words, I want an arrow stem to be as long as the varying
>> [rate], and if the stem has a length greater than zero then and only then do
>> I want an arrow head at the end of the stem pointing in the same direction
>> as the stem. ***
>> 
>> I even tried using a truetype font symbol, but I get no image at all but no
>> error as well.
>> 
>> I even tried using a SYMBOL of TYPE pixmap pointing to an image of an
>> arrow. I realize that if I could make that work, it would still be
>> unsatisfactory because as MapServer would scale my arrow image, it would
>> make the attached arrow head also larger, and that would look ugly. In any
>> case, I couldn't get that to work as well... no image at all, but no error
>> as well.
>> 
>> Could be my compilation of MapServer was buggy, but I didn't see any
>> compilation time errors, and other than the above oddit

Re: [mapserver-users] arrow head doesn't draw at the end

2011-09-28 Thread Mr. Puneet Kishor
Hi Thomas,


On Sep 28, 2011, at 8:15 AM, thomas bonfort wrote:

> On Wed, Sep 28, 2011 at 15:09, Mr. Puneet Kishor  wrote:
>> Hi luis,
>> 
>> Thanks for helping out. I will try OVERLAYSYMBOL, but from the docs it seems 
>> it is no different that using two stacked symbols. I did try GAP, but that 
>> doesn't help at all.
>> 
>> As I mentioned below, I am drawing these points, not unlike the recent 
>> thread started by Brent on drawing wind barbs. Except, in my case, these are 
>> GPS sensor readings. The reading values are always 0 or more (actually, they 
>> are close to 0, but let's say, the really tiny ones are identifiable). The 
>> readings have two values... rate and azimuth.
>> 
>> The length of the arrows has to be drawn proportional to the rate, and 
>> arrows have to be pointed toward the azimuth.
>> 
>> First, I don't want arrows on the 0 (or, close to 0) readings but I still 
>> want to show them. So, I've decided I will just select them out and draw 
>> them as a separate layer with just dots. Easy.
>> 
>> Now, the ones that are to be drawn with an arrow: the problem I am facing is 
>> that I want the arrow head at the end of the arrow stem that is of a 
>> non-predictable length. Even though the docs imply that I can achieve this 
>> with GEOMTRANSFORM, I have failed to do so. And, of course, just now I 
>> learned that perhaps that could be because GEOMSTRANSFORM applies *only* to 
>> LINE layers.
> 
> The docs have *never* implied that, even if you might have wanted them to.
> "end: produces the last point of the geometry": the last point of a
> point geometry is the point itself, which is what is happening.


Now it makes crystal clear sense. Nevertheless, consider that until as of this 
moment, I did take the docs to imply that the geometry in this case was the 
geometry of the symbol. When I say "imply," I am not accusing anyone of 
misleading. I am asserting that the way "a truth" has been stated in the 
document can and has appeared as "another truth" to someone else.

Just changing the docs to what you explained above would be fantastic.

Additionally, per Havard, GEOMTRANSFORM apparently doesn't even apply to 
POINTs. Which now makes sense, since a point geometry's start, middle and end 
are exactly the same. However, again, stating this in the docs would be super 
helpful.


> 
> 
>> 
>> Seems to me the *only* reasonable way to achieve this would be to have a 
>> GEOMTRANSFORM kind of capability for POINT layers as well, so that the last 
>> (or first or whatever... the specified) point of the symbol geometry could 
>> be decorated with another symbol.
> 
> again, geomtransform applies to the underlying feature, not the symbol
> you are rendering on top of the feature. geomtransform will not help
> in your case.
> 
> as paul suggested, you need to classify your data with a different
> symbol depending on your [rate], and use the azimuth for the
> orientation.
> 


Hmmm I am trying to figure out which "Paul" suggested "where" in this 
thread. Perhaps you are referring to the wind barb thread.

In any case, I am not sure what you mean by "classify your data with a 
different symbol depending on your [rate]." The way I am understanding that 
sentence is that I should have an actual different symbol for every different 
rate. Well, that will not only not work for me, it would defeat the purpose of 
all this automation. I have ~3000 points, each with a different rate. I can't 
possibly have 3000 symbols. Not just that, these rates change on a daily basis.

Background -- these are readings from almost 3000 stations around the world 
reporting the rates daily. I get new values on a daily basis, so every day I 
would have a different map. (actually, it is a lot more complicated than that, 
but that is a good depiction of the problem).

Many thanks again for your assistance, but I hope the above clarifies the 
issues.


>> 
>> I am open to all kinds of suggestions at this point.
>> 
>> 
>> On Sep 28, 2011, at 3:04 AM, luis peinado wrote:
>> 
>>> Hi, just trying to help.
>>> I used some trick with arrows than maybe can help you with some variation.
>>> I use mapserver-5.X and the way it worked for me was a LINE type layer using
>>> a normal class (continous line) with an OVERLAYSYMBOL, using  a ">"
>>> character.
>>> Maybe changin some parameters like GAP may be useful to you.
>>> 
>>> This is my class on a TYPE LINE layer
>>> CLASS
>>> NAME "capa_tub"
>>> SYMBOL "continous"
>>

Re: [mapserver-users] output template trimlast doesn't work

2011-09-29 Thread Mr. Puneet Kishor

On Sep 27, 2011, at 6:15 PM, jjwang wrote:

> This is my template file.
> The *trimlast=','* statement doesn't work.
> Any idea on this?
> 
> // mapserver template
> [resultset layer=pd]
> [
>[feature trimlast=',']
>{
>  "id": "[id]",
>  "description": "[description]",
>  "venue": "[venue]",
>  "year": "[year]"
>},
>[/feature]
> ]
> [/resultset]
> 


I experienced the same.

--
Puneet Kishor

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Parameter substitution problem

2011-09-29 Thread Mr. Puneet Kishor

On Sep 29, 2011, at 8:22 AM, Asad Ullah wrote:

> Steve,
> Thanks very much for your help. Adding quote did not change anything. 
> However, if I change file name from, for example, 
> "OMI-Aura_L3-OMCLDRRclpWMSNRT_20110922.png" to " 
> OMI_OMCLDRRclpWMSNRT_20110922.png" and do the substitution as:
> 
> "/cgi-bin/mapserv.cgi?map_layer[OMI_CP]=DATA+OMI_OMCLDRRclpWMSNRT_"+ 
> amsreDate + ".png"
> 
> It would work. Where the validation block is same as:
> 
> VALIDATION
>   'DATA' '^OMI_.*\.png$'
> END
> 
> So, do you think the problem is with validation definition?



Could it be the dashes (-) in the problematic file name?



> 
> Thanks,
> 
> Asad
> 
> 
> -Original Message-
> From: Steve Lime [mailto:sdl...@gmail.com] 
> Sent: Wednesday, September 28, 2011 11:27 PM
> To: Asad Ullah; mapserver-users@lists.osgeo.org
> Subject: Re: [mapserver-users] Parameter substitution problem
> 
> What happens if you quote the variable in the CGI call, that is:
> 
>  "/cgi-bin/mapserv.cgi?map_layer[OMI_CP]=DATA+'OMI-Aura_L3-OMCLDRRclpWMSNRT_"+
> amsreDate + ".png'"
> 
> Note the single quotes in the DATA value... I'll try to whip up local test 
> case.
> 
> Steve
> 
> On Tue, Sep 27, 2011 at 4:28 PM, Asad Ullah  wrote:
>> Steve,
>> 
>> DATA in  the URL has quotes as:
>> 
>> "/cgi-bin/mapserv.cgi?map_layer[OMI_CP]=DATA+OMI-Aura_L3-OMCLDRRclpWMSNRT_"+
>> amsreDate + ".png"
>> 
>> I unquoted the value in mapfile but there was no error. Any more suggestion?
>> 
>> 
>> 
>> Thanks,
>> 
>> 
>> 
>> Asad
>> 
>> 
>> 
>> 
>> 
>> From: Steve Lime [mailto:sdl...@gmail.com]
>> Sent: Friday, September 23, 2011 4:55 AM
>> To: Asad Ullah
>> Cc: mapserver-users@lists.osgeo.org
>> Subject: Re: [mapserver-users] Parameter substitution problem
>> 
>> 
>> 
>> My guess is the validation is correct but the syntax of the URL parameter is
>> is wrong in that the value passed for DATA is not quoted. If you unquote the
>> default value in your mapfile does that result in a error? That would be an
>> easy way to test the need for quotes.
>> 
>> One last idea, while map_layer... should work, try map.layer... instead as
>> you variable name.
>> 
>> If you're really are just replacing the date part you could do that by doing
>> a runtime sub...
>> 
>>  DATA "OMI-Aura_L3-OMCLDRRclpWMSNRT_%date%.png"
>>  VALIDATION
>>  date 'regex'
>>  END
>> 
>> And then you pass date as a CGI variable.
>> 
>> Steve
>> 
>> On Thursday, September 22, 2011, Asad Ullah 
>> wrote:
>>> List,
>>> I am trying to substitute DATA parameter in my mapfile with a call from
>>> Openlayers as follow:
>>> 
>>> map_layer[OMI_CP]=DATA+OMI-Aura_L3-OMCLDRRclpWMSNRT_"+ amsreDate + ".png"
>>> 
>>> The mapfile is:
>>> 
>>> LAYER
>>>  NAME "OMI_CP"
>>> TYPE RASTER
>>> STATUS DEFAULT
>>> OFFSITE 0 0 0
>>>  PROJECTION
>>> "init=epsg:4326"
>>>   END
>>> DATA "OMI-Aura_L3-OMCLDRRclpWMSNRT_20110922.png"
>>> VALIDATION
>>>   'DATA' '^OMI_.*\.png$'
>>> END
>>> 
>>> The call should change the date part (20110922) of the png filename but it
>>> is not doing it. Can anyone point to what I am doing wrong here?
>>> 
>>> Thanks,
>>> 
>>> Asad
>>> 
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] problem with MapServer as WMS client

2011-10-16 Thread Mr. Puneet Kishor

On Oct 16, 2011, at 3:00 PM, Rahkonen Jukka wrote:

> Hi,
> 
> Have you tried to do it like it is suggested in the documentation 
> http://mapserver.org/ogc/wms_client.html?
> 
> LAYER
>  NAME "country_bounds"
>  TYPE RASTER
>  STATUS ON
>  CONNECTION "http://demo.mapserver.org/cgi-bin/wms?";
>  CONNECTIONTYPE WMS
>  METADATA
>"wms_srs" "EPSG:4326"
>"wms_name""country_bounds"
>"wms_server_version"  "1.1.1"
>"wms_format"  "image/gif"
>  END
> END
> 
> Thus no PROJECTION for the layer and only EPSG:4326 in wms_srs.  EPSG:900913 
> must be included in the MAP level "wms_srs" but that should be enough.


That was it. Thanks no PROJECTION for the layer, and only EPSG:4326 in 
wms_srs. Additionally, I was too smart for my own good and had set the TYPE to 
POLYGON. I guess it should be RASTER because, from the perspective of 
MapServer, it is getting back an image, no?


> 
> Including name of the remote mapfile into CONNECTION string is OK.
> Perhaps addind DEBUG 5 into your WMS layer definition writes the request into 
> log file but I do not know. Try and see if it helps.


I did bump the DEBUG level to 5, but that doesn't show the WMS calls.


>  At least you can run some local proxy like Fiddled and let it log the web 
> traffic. In that case you will need to add wms_proxy_host and wms_proxy_port 
> into layer metadata.
> 
> -Jukka Rahkonen- 
> 
> 
> Lähettäjä: mapserver-users-boun...@lists.osgeo.org 
> [mapserver-users-boun...@lists.osgeo.org] käyttäjän Puneet 
> Kishor [punk.k...@gmail.com] puolesta
> Lähetetty: 16. lokakuuta 2011 2:57
> Vastaanottaja: mapserver-users@lists.osgeo.org
> Aihe: [mapserver-users] problem with MapServer as WMS client
> 
> I am going from OpenLayers to MapServer acting as a WMS client to a remote 
> server. OL is requesting SRS 900913, and the remote server is sending data in 
> 4326, and I want to send it back to OL in 900913. My layer definition is like 
> so
> 
>LAYER
>NAME "foo"
>TYPE POLYGON
>STATUS ON
>CONNECTION "http://server/cgi-bin/mapserv?map=mapfile.map";
>CONNECTIONTYPE WMS
> 
>PROJECTION
>"init=epsg:4326"
>END
> 
>METADATA
>wms_srs "EPSG:900913 EPSG:4326"
>wms_name"foo"
>wms_server_version  "1.1.1"
>wms_format  "image/png"
>wms_enable_request  "*"
>wms_extent  "-180 -90 180 90"
>END
>END
> 
> I am getting the following error
> 
> msWMSLoadGetMapParams(): WMS server error. Invalid SRS given: SRS must be 
> valid for all requested layers.
> 
> I have three questions:
> 
> 1. The docs at http://mapserver.org/ogc/wms_client.html state that the 
> connection should not have any query params, but I don't see any options to 
> pass the map file name. Is it ok the way I am doing it above?
> 
> 2. How do I get around the above error?
> 
> 3. Is there a way I can see the actual request that MapServer is making to 
> the remote server, perhaps in the error.log?
> 
> 
> --
> Puneet Kishor___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] time enabled WMS with elements instead of elements

2012-01-11 Thread Mr. Puneet Kishor
Tim,

(top posting because I have a more generic response)

I have tackled this very much like you did with multiple images and opacity, 
etc. I too considered a movie, but the problem with a movie is that you can't 
zoom in. The images are geo-referenced, so you can zoom in and out and pan and 
drag. I was using OpenLayers, so I created a "scrubber" (a jQuery slider) and 
tied it to layer loading and unloading. I would query for an image and draw it 
only if the user moved slider to request a specific image. It was not very 
smooth, but it did work.

You can decrease the "weight" of the images by using GIFs, at least, that is 
what I did. I remember I had 100 images (one for each year for a century's 
worth of model run) and the performance was quite good. I did pre-calculate the 
images at different zoom levels -- I believe there were 12  zoom levels, so I 
generated 1200 images and then used OL's layer image type.

Wish it were possible to zoom, pan, drag a movie as if it were a map.


On Jan 11, 2012, at 8:10 PM, Tim-Hinnerk Heuer wrote:

> Hi,
> 
> Interested in HTML5 + MapServer and visualisation, read on.
> 
> Happy new year to you all!
> 
> I'm working on a rather interesting project at the moment where we need to 
> map data over time. We tried experimenting with having one layer for each 
> time unit and essentially overlaying them, manipulating their opacity to have 
> a mini movie, but we noticed that the downloads of all the images become 
> quite significant (61MB for a test extent!). I then implemented a proof of 
> concept page (HTML5) where I took an extent's images and concatenated them in 
> a webm video over time and then played all the videos at the same time, 
> giving me a nice visualisation of that area at a relatively low cost (2.3MB 
> per that extent) and the advantage of streaming.
> 
> I have already written a script that generates all the videos, so I have 
> invested considerable amounts of time into this.
> 
> It would be great now if I could use the Apache module mapcache to serve up 
> these videos listening and responding to WMS requests. So, all I need to 
> change about mapcache is to serve a .webm file with MIME type video/webm 
> instead of a .png file at the given extent. I guess I could write something 
> in PHP or even with MapScript to serve up those files, but
> 
> A) I don't know how mapcache finds the right image for an extent and
> B) Although I know C, my knowledge of it is a bit rusty and I don't know the 
> interface(s) for writing Apache modules in C, let alone a plugin for mapcache
> 
> I'm keen on learning, but if someone knows where in the code I would have to 
> look for this change/feature enhancement it would be really helpful.
> 
> Has something like that been done already or is in experiment/planning?
> 
> If you could give me some hints of how to approach this in the quickest way 
> possible I would be very grateful. Of course this is a project which needs to 
> be done quickly but I want to do it anyway, because it's fun.
> 
> Thanks for reading and hopefully you have an answer!
> 
> Regards,
> Tim
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] zoom to place by name

2012-01-30 Thread Mr. Puneet Kishor
a'ite, this question is neither mapserver-specific nor OL-specific (two 
technologies that I am using gung-ho right now), but both would be involved in 
developing something that I describe below --

you know, how in Google Maps you can type pretty much any location's name, and 
if it finds a match in its database, Google Maps zooms to the boundary of that 
location. For example, if I type 

http://maps.google.com/maps?q=Zurich,+Switzerland

or 

http://maps.google.com/maps?q=Dane+County,+WI

or 

http://maps.google.com/maps?q=New+York+City

the map zooms to the bounds of that location. This is what I want to develop, 
for the entire world. I guess the starting point would be the geonomes 
database, except, if I understand correctly, geonames does not have the bounds 
of locations. Instead, it has only the centroids of locations.

A better way might be something like the following --

I am using Google Maps as my base layer anyway. Could I somehow submit a search 
through my application to the Google Maps base layer, return the bounds and 
zoom to that?

Thoughts? Suggestions?

--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: from kml styles to mapserver layer classification

2012-02-20 Thread Mr. Puneet Kishor

On Feb 20, 2012, at 4:44 PM, Puneet Kishor wrote:

> I have a kml with a bunch of styles to color polygons. Is there a quick/easy 
> way to extract them and convert them to MapServer layer classification rules?
> 


the above actually turned out to be a lot easier than I thought... about 4 
lines of Perl.


Now, I have a table with geometry, and colors for each feature.

CREATE TABLE t (attr, hex_color, the_geom);

How can I color the polys in the layer with the hex_color values? Looking at 
the map file docs, I came up with something like so

LAYER
NAME "foo"
DATA "the_geom FROM (SELECT gid, rgb(hex_color) AS rgb_color, the_geom 
FROM t) tmp USING UNIQUE gid USING srid=4326"
STATUS ON
TYPE POLYGON
CLASS
STYLE
COLOR [rgb_color]
OUTLINECOLOR 68 68 68
END
END
END
END

where rgb() converts "hex_color" to a string of RGB triplets. So, "00" 
becomes "0 0 0".

Is the above correct? For now, it doesn't seem to be working for me.

Many tia,


--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: from kml styles to mapserver layer classification

2012-02-20 Thread Mr. Puneet Kishor
Hi Richard,

On Feb 20, 2012, at 9:21 PM, Richard Greenwood wrote:

> On Mon, Feb 20, 2012 at 8:05 PM, Mr. Puneet Kishor  
> wrote:
> 
>> How can I color the polys in the layer with the hex_color values?
> 
> COLOR "#ff"



So, I can use the hex values directly. Cool. But, will the following be 
sufficient in the map file?

   LAYER
   NAME "foo"
   DATA "the_geom FROM (SELECT gid, hex_color, the_geom FROM t) tmp USING 
UNIQUE gid USING srid=4326"
   STATUS ON
   TYPE POLYGON
   CLASS
   STYLE
   COLOR [hex_color]
   END
   END
END
   END


--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: from kml styles to mapserver layer classification

2012-02-20 Thread Mr. Puneet Kishor
Mike (and Richard),

Thanks for the advice, but I didn't have to use gdal. As I wrote in another 
email, 5 or so lines of Perl code extracted the hex color values and inserted 
them in the Postgres table. From there, it was just a matter of knowing the 
correct map file syntax. Richard's suggestion of prefixing the # sign was spot 
on, which I added right in the Pg column. Then, the CLASS STYLE shown below 
worked really well.

Many thanks all.


On Feb 20, 2012, at 9:27 PM, Smith, Michael ERDC-CRREL-NH wrote:

> Puneet,
> 
> A very recent version of gdal, last couple of weeks, can convert KML
> styles into OGR style strings. MapServer can use those OGR Style strings
> with the AUTO style option.
> 
> Mike
> 
> -- 
> Michael Smith
> 
> US Army Corps
> Remote Sensing GIS/Center
> 
> 
> 
> On 2/20/12 10:23 PM, "Mr. Puneet Kishor"  wrote:
> 
>> Hi Richard,
>> 
>> On Feb 20, 2012, at 9:21 PM, Richard Greenwood wrote:
>> 
>>> On Mon, Feb 20, 2012 at 8:05 PM, Mr. Puneet Kishor
>>>  wrote:
>>> 
>>>> How can I color the polys in the layer with the hex_color values?
>>> 
>>> COLOR "#ff"
>> 
>> 
>> 
>> So, I can use the hex values directly. Cool. But, will the following be
>> sufficient in the map file?
>> 
>>  LAYER
>>  NAME "foo"
>>  DATA "the_geom FROM (SELECT gid, hex_color, the_geom FROM t) tmp
>> USING UNIQUE gid USING srid=4326"
>>  STATUS ON
>>  TYPE POLYGON
>>  CLASS
>>  STYLE
>>  COLOR [hex_color]
>>  END
>>  END
>>  END
>>  END
>> 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Inefficient rendering of layer

2012-03-27 Thread Mr. Puneet Kishor

On Mar 27, 2012, at 12:17 PM, juliap wrote:

> SELECT geom , VotingFor FROM dbo.[BF_PROV_ELECTORAL_DIVISION] AS
> elec WITH (INDEX(ogr_geom_sidx)) JOIN dbo.[Survey] ON GeoL.STWithin(geom) =
> 1 
>WHERE PartyVotingFor = 
> ( SELECT TOP 1 [VotingFor] FROM dbo.[BF_PROV_ELECTORAL_DIVISION] AS
> elec2 WITH (INDEX(ogr_geom_sidx)) JOIN dbo.[Survey] ON GeoL.STWithin(geom) =
> 1 
>   WHERE VotingFor <= '4' AND elec.ID = elec2.ID
>   GROUP BY VotingFor
>   ORDER BY COUNT(VotingFor)DESC



You should analyze that query directly against the database, that is, not via a 
mapfile query, to figure out where it is taking time. Perhaps it is looping 
unnecessarily, perhaps it is not using the indexes where you expect them to... 
only EXPLAIN ANALYZE will tell for sure.

Once you have the query running quick, it will be quick in MapServer as well.



--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] elevation profile

2012-05-05 Thread Mr. Puneet Kishor
The elevation profile widget is finally implemented at 
http://earth-base.org/geomaps

Click on the fourth button from the top on the left, then draw a line on the 
map to see the profile. As with all my apps, the values themselves can be 
retrieved by querying for them directly from the browser or from the command 
line. For example

http://earth-base.org/geomaps/elevation.json?linestring=LINESTRING(-118.706+37.933%2C-109.477+42.494)


This one is dedicated to Steve Woodbridge, Brent Wood and David Fawcett.



> ..




--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: line symbol decoration is flipped, how do I ensure the correct orientation

2012-05-20 Thread Mr. Puneet Kishor
bu..hump.

Any ideas from one of you carto wizards? The flipped symbol is serving up 
faulty faults.


On May 9, 2012, at 6:55 PM, Puneet Kishor wrote:

> I am trying my hand at MapServer symbols/styles. Using the following 
> definition
> 
>SYMBOL
>NAME "rarrow"
>TYPE vector
>FILLED false
>POINTS
>0 0
>4 0
>2 -1
>END
>END
> 
>SYMBOL
>NAME "larrow"
>TYPE vector
>FILLED false
>POINTS
>4 0
>0 0
>2 1
>END
>END
> 
>CLASS
>NAME "Strike-slip fault right lateral"
>EXPRESSION "30"
>STYLE
>COLOR 0 0 0
>WIDTH 1
>END
> 
>STYLE
>COLOR 0 0 0
>SYMBOL "rarrow"
>SIZE 4
>GAP -60
>OFFSET 0 -4
>END
> 
>STYLE
>COLOR 255 0 0
>SYMBOL "larrow"
>SIZE 4
>GAP -60
>OFFSET 0 6
>END
>END
> 
> I get the following http://dl.dropbox.com/u/3526821/slip_strike.png
> 
> 
> The green box shows the correct symbol. The red box has the symbol flipped. 
> Why? How can I correct this?
> 
> --
> Puneet Kishor

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users