Re: [mapserver-users] Bulk creation of mapfile

2014-08-13 Thread Cristiano Sumariva
I took the plpgsql way. Created a set of functions that generates the
mapfile blocks and store the tokens in several postgresql tables(using
traditional SQL relations).

Then I invoke the mapfile( id ) from database and pass the mapfile text
direct to mapscript.
With this, the mapfile creation has been managed by the database and did
not need any files.

Since all layers are already at database, I do not think those generation
steps take some much processing.
It is working for a few layers already loaded.

Current postgresql could also store them as XML. Recent mapserver could
parse xml mapfiles. But never implemented something this way.



2014-08-13 15:08 GMT-03:00 Alex Lopes :

> Thank you everybody who helped me. I'll study all the suggestions and post
> here the complete source code of my solution.
>
> Alex
>
>
> 2014-08-13 9:34 GMT-04:00 Jeff McKenna :
>
> Definitely leverage mapfile INCLUDEs (http://mapserver.org/mapfile/
>> include.html). In your case, each LAYER could be an include, and you
>> could have a mapfile template file that your shell script writes those
>> include layers into.
>>
>> I recently saw a presentation at FOSS4G-Europe from PropertyShark, who
>> manages thousands of layers, using includes, and generates them through
>> custom Perl scripts (you can read about that discussion, or contact them,
>> through the recent Google+ discussion https://plus.google.com/
>> communities/103841604654304099367).
>>
>> -jeff
>>
>>
>> --
>> Jeff McKenna
>> MapServer Consulting and Training Services
>> http://www.gatewaygeomatics.com/
>>
>>
>> On 2014-08-13 10:03 AM, Alex Lopes wrote:
>>
>>> Hi Everybody,
>>>
>>>
>>> I need to create a script shell to build thousands of mapfiles based on
>>> postgis layers.
>>>
>>> Which is the best way to accomplish this task?
>>>
>>> Best regards,
>>> Alex
>>>
>>>
>>>
>> ___
>> 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] Random error 500 over WMS mapscript?

2014-08-04 Thread Cristiano Sumariva
I would like to known if some else suffered from random error 500 with
apache and PHP mapscript.
If I copy the same tile URL and load it on another browser tab the image
shows up without error.

Here a sample URL from production server:
http://www.ecologia.ufrgs.br/atlasdigital/mapa-ta/index.php/mapa/ows?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=m7&STYLES=&SRS=EPSG:4326&BBOX=-51.328125,-29.99300228455107,-51.240234375,-29.91685223307016&WIDTH=256&HEIGHT=256&FORMAT=image/png

I am overlaying these "WMS tile" on top of google maps.
The browser starts several concurrent requests.

I using the recent 6.4.1 mapserver compiled from source.

Already checked error logs to see if something traced but no error found.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Mapfile VS MapScript performance

2012-11-07 Thread Cristiano Sumariva
Also using mapscript you can integrate mapserver with application by saving
mapfile into database and letting application manage the mapserver
configuration, grant access to authenticaded session clients
You will lose speed but win maintenance.
I do not really like to update the mapfile, then the tilecache then seed
tiles again for each small change.

2012/11/7 Umberto Nicoletti 

> The performance point being made clear by Thomas I think I should mention
> a couple of (mostly in functionality) advantages that the WxS wrappers
> might have against cgi/fastcgi:
>
> 1. it is easy to extend the wrapper to add accounting, logging, caching.
> True, accounting and logging can also be accomplished simply by processing
> the web server log files but that requires  extra software and might not be
> easy to impement in complex situations (think a cached request costs x and
> a non-cached y)
>
> 2. request preprocessing: filtering layers, redirecting
>
> 3. image/response prostprocessing: caching, assembling, watermarking,...
>
> Umberto
>
>
>
>
> On Wed, Nov 7, 2012 at 10:15 AM, thomas bonfort 
> wrote:
>
>> - testing against cgi isn't really an objective test, but even so the
>> differences will iron out as soon as the actual workloads are not trivial
>> (i.e. if you're just benchmarking getcapabilities then sure, mapscript
>> keeping in memory your mapfile will be orders of magnitude faster than cgi.
>> switching to complex map draws will show very similar performance between
>> both options)
>> - using fastcgi will somewhat iron out the differences on trivial
>> workloads
>> - certain mapscript scripts will leak non trivial amounts of memory,
>> forcing server restarts periodically if you don't have an infinite amount
>> of memory available.
>>
>> with all that said, my recommendation is to stick with cgi/fastcgi unless
>> you have very specific needs that force you to use mapscript.
>>
>> --
>> thomas
>>
>>
>> On Wed, Nov 7, 2012 at 9:42 AM, Umberto Nicoletti <
>> umberto.nicole...@gmail.com> wrote:
>>
>>> I have tested cgi against python mapscript (with mod_python) and the
>>> performance improvement, as expected, is massive.
>>>
>>>
>>> On Wed, Nov 7, 2012 at 8:53 AM, Spirifer  wrote:
>>>
 Hi,

 I would to use MapServer to create WMS/WFS services.

 I think to compare 2 systems to produce services:
 1) Apache + MapServer CGI + static mapfile (.map)
 2) Apache + MapScript PHP + map configuration in cache

 Somebody has tested the performance between the mapfile and MapScript ?

 Thanks.



 --
 View this message in context:
 http://osgeo-org.1560.n6.nabble.com/Mapfile-VS-MapScript-performance-tp5014463.html
 Sent from the Mapserver - User mailing list archive at Nabble.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 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] WFS fails if table name includes a dot character

2012-10-09 Thread Cristiano Sumariva
Uppercase chars in table names will also cause trouble, avoid them.

2012/10/9 Puneet Kishor 

>
>
> On Oct 9, 2012, at 7:51 AM, Rahkonen Jukka 
> wrote:
>
> > Hi,
> >
> > It may be an odd idea to use dots in table/feature type names, but
> because I made such a test and faced a problem so I report it here.
> > Source table is in PostGIS and its name is "dot.test".  WFS
> DescribeFeatureType leads to following error
> >
> > [Tue Oct  9 10:56:02 2012].214191 msPostGISLayerGetItems(): Query error.
> Error
> > (ERROR:  schema "dot" does not exist
> > LINE 1: select * from dot.test where false limit 0
> >  ^
> > ) executing SQL: select * from dot.test where false limit 0
> > [Tue Oct  9 10:57:12 2012].923891 msPostGISLayerGetItems(): Query error.
> Error
> > (ERROR:  schema "dot" does not exist
> > LINE 1: select * from dot.test where false limit 0
> >  ^
> > ) executing SQL: select * from dot.test where false limit 0
> >
> >
> > -Jukka Rahkonen-
> > ___
> > mapserver-users mailing list
> > mapserver-users@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
> If using non-standard characters, double quote the entity name. So, try
>
> SELECT * FROM "dot.test" WHERE ...
>
> To be completely unambiguous, prefix the schema name. So, if the table is
> in schema foo, try
>
> SELECT * FROM "foo.dot.test" WHERE ...
>
>
>
>
>
> --
> 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] Re: interesting thread on JSON-ish output from MapServer

2011-09-12 Thread Cristiano Sumariva
Why do this the hard way? Mapserver now can generate KML output.
Just create a KMLLayer on google maps API an it will do all for you.

The KMLlayer do the ajax request for you, setup the click handler on Map,
setup the infoWindow events all in a two line call, support all simple
features geometry types for vector data.

On mapserver side, setup the kml layer, bind an attribute to the kml name
attribute that will de the infowWindow header.
For additional text on info window you can instruct mapserver to assembly an
HTML template to the kml description attribute.
? Can someone put an layer example for this case ?

Check out KML sample builder for details
http://kml-samples.googlecode.com/svn/trunk/interactive/index.html

and Mapserver
http://mapserver.org/output/kml_output.html

and Maps API KML
http://code.google.com/intl/pt-BR/apis/maps/documentation/javascript/reference.html#KmlLayer

If mapserver options do not meet your requires is very easy to create KML
without Mapserver at all.
The problem now is turning into to force mapserver do what google requires.
If mapserver is becoming hard to do it, you make your logic without it.


2011/9/12 Steve Lime 

> The forward could be to a JavaScript file with an empty object. Browser
> should follow ok...
>
> Sent from my iPad
>
> On Sep 11, 2011, at 4:58 PM, Mr. Puneet Kishor 
> wrote:
>
> >
> > 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
>
___
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-12 Thread Cristiano Sumariva
Also there is the LAYER TILEINDEX
http://mapserver.org/optimization/tileindex.html#tileindex
that may do that you need. Like a virtual mosaic.

2011/9/12 Rahkonen Jukka 

> Hi,
>
> You will do it with "ogrtileindex". Read
> http://www.mapserver.org/optimization/tileindex.html
>
> -Jukka Rahkonen-
>
> Mr. Puneet Kishor wrote:
>
> > 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
> ___
> 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] Re: About shapefile generation in PHP with DBF

2010-08-09 Thread Cristiano Sumariva
Yes I want data creation/conversion from a user interactive query generated
from a set of tables.

I maded some executions of ogr2ogr.
This tool looked as a good solution.
The problem is that the results may take long to execute( in case of a join
between two tables like 10 million rows  history info and a 10 thousand
spatial feature table ).
I will first try execute this tool by launching a PHP monitor script process
using a shared memory buffer.
With the -progress flag i will try parse the output string to show some kind
of progress bar.
Put the monitor to sleep and in case of an abort/timeout from client kill
the ogr2ogr process and free system resources.
On client side I will pool server for status info.

2010/8/9 Sumit Sharma 

>
> Although I not an expert of PHP, still I assume you are looking for tool
> for
> data conversion. I use ogr2ogr utility. It is GDAL utility and very
> effective as well. Hope this will serve the purpose.
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/About-shapefile-generation-in-PHP-with-DBF-tp5381714p5388011.html
> Sent from the Mapserver - User mailing list archive at Nabble.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] About shapefile generation in PHP with DBF

2010-08-06 Thread Cristiano Sumariva
I took a look at documentation in PHP mapscript but did not find a way to
create the .dbf file.
Do mapserver classes has support for generating attribute .dbf file?
If not any sugestion for an ready to use tool that I can use?
For database export one option I found  was to call pgsql2shp with a
prepared query but must have exec function enabled to do this.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] mapserver >= 5.6 and querys via php-mapscript

2010-06-11 Thread Cristiano Sumariva
If I remember well the loader script shp2pgsql create the unique attribute
called gid. And that gid I supose be the record id or record position from
the shape source file.
So if you need a map between file position and database record returned read
the attribute 'gid' from that shape record.

I do not know if still done on recent versions of loader.



2010/6/10 Lime, Steve D (DNR) 

>  The concept changed in 5.6 to support improved query performance,
> especially for RDBMS data sources. It’s been a bit of
>
> a cluster though and interpretation of $result->shapeindex varies by 5.6.x
> version and driver. We’ll get this straightened
>
> out and simplified in 6.0. Addressing 5.6.3 only:
>
>
>
> -  shapeindex should hold the global record index for a shape
>
> -  tileindex should hold the result set record index for a shape
> (for RDBMS data sources, e.g. Oracle and PostGIS only)
>
>
>
> There still may be inconsistencies with OGR-fronted RDBMS sources.
>
>
>
> Steve
>
>
>
> *From:* mapserver-users-boun...@lists.osgeo.org [mailto:
> mapserver-users-boun...@lists.osgeo.org] *On Behalf Of *Sven Schroeter
> *Sent:* Thursday, June 10, 2010 10:27 AM
> *To:* mapserver-users@lists.osgeo.org
> *Subject:* Re: [mapserver-users] mapserver >= 5.6 and querys via
> php-mapscript
>
>
>
> Hi Daniel,
> >
> > I don't think there is any way to get the "real" shapeindex unless you
> > have an id field in the data itself. You could file a ticket about this,
> > but for some data sources, such as Postgis, Oracle Spatial, and many OGR
> > ones, there is no concept of absolute record id, so if something was
> > added, it would very likely work only for shapefiles
> >
>
> in the older ms versions I got with $result->shapeindex an absolute record
> id for all data sources (postgis, OGR, shapefiles).
> what ids were used before by default e.g. for postgis data?
> why this concept has changed in the new version 5.6?
> Thanx
> Sven
>
> ___
> 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] Escape caracter on Mapfile

2010-06-08 Thread Cristiano Sumariva
People I got on this situation: mixing single quotes with double quotes.
Mapserver say at following page :
http://mapserver.org/mapfile/expressions.html
that for expressions it allow escape.
Do it allow escape on other mapfile attributes ?

Current mapserver version is 5.4.1

I need the following string layer data attribute to create an query to
perform a column concat since address is a compound information and has some
null values.
I know some will say fix your data.

It is stopping at CATEG: Parsing error near (CATEG)

data "the_geom from ( select oid, *, \"CATEG\"||( CASE WHEN \"PREP\" is null
THEN ' '::text ELSE \"PREP\" END )||\"LOGR\" as full_address from
street_main_dissolv_utm ) as
street_main_address_with_length_over_ten_kilometer"


Postgresql lexer rules are:
 Identifiers are quoted with double quotes.
 A column name is an identifier.
 And column name identifiers not quoted are lower cased.
 So need the double quotes around those upper case identifiers.

 Text strings are quoted in single quotes.
 || is string concat operator
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Question about PHP object comparison

2010-04-09 Thread Cristiano Sumariva
I executed this example and object comparison returned true on clone call.
But it returned false when I request another reference from same layer from
getLayer.
Should not it return true ?


#/* 09/04/2010 test for mapserver object comparison on PHP.
# If I clone a layer object from a map instance and compare the cloned with
ref, do they are the same ?
# Answer: yes.
# PHP state: Two object instances are equal if they have the same attributes
and values, and are instances of the same class
#require_once dirname( __FILE__ ).'/class/mapfile/Mapfile.php';
#Mapfile::checkLibrary();

$map = ms_newMapObj( '' );
var_dump( $map->numlayers );
$l = ms_newlayerobj( $map );
var_dump( $map->numlayers );
print( nl2br( "\n" ) );
$l->set( 'type', MS_LAYER_POLYGON );
#var_dump( $l->type );
$lClone = clone $l;
var_dump( __LINE__, ( $l == $lClone ) );
var_dump( __LINE__, ( $l == $map->getLayer( 0 ) ) );
$lRef = $map->getLayer( 0 );
var_dump( __LINE__, ( $l == $lRef ), $l->type, $lRef->type );

#repeated test but now with $l from the reference from getLayer
print( nl2br( "\n" ) );
$l = $map->getLayer( 0 );
$lClone = clone $l;
var_dump( __LINE__, ( $l == $lClone ) );
var_dump( __LINE__, ( $l == $map->getLayer( 0 ) ) );
$lRef = $map->getLayer( 0 );
var_dump( __LINE__, ( $l == $lRef ), $l->type, $lRef->type );

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


[mapserver-users] List all symbols on PHP ms_map_object

2010-03-25 Thread Cristiano Sumariva
I want read all symbols available in a mapfile for listing.

Documentation says that I can request symbol references by calling
ms_map_obj->getSymbolById( id ).

What is not well defined on documentation is if those id are numbered from
zero to n-1 symbol.
so I can loop over the list.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users