9

This can be done quite easy in SQL All the below examples can be tested directly on http://postgisonline.org/map.php. Just paste the query and press Map1 SELECT GENERATE_SERIES(FLOOR(ST_YMin(the_polygon))::int , CEILING(ST_YMax(the_polygon))::int,200) y_value, ST_XMin(the_polygon) x_min, ST_XMax(the_polygon) x_max from (SELECT the_geom AS ...


6

Mapfiles are good for making standard WMS, WFS and WCS services. They are mostly stable even some limited set of the mapfile parameters can be changed on-the-fly by using the variable substitution mechanism. Static mapfiles are enough for serving data to GIS clients like ArcGIS, QGIS, OpenJUMP etc. and also for browser applications made with OpenLayers or ...


4

For shapefiles you should write "mapserver style" filtering expressions, e.g. layer.setFilter("([id] = 1)") The syntax you are using would be OK for RDBMS backends only (passed to a SQL where clause)


4

Calvin, For the WMS service itself MapServer already handles the GET and POST requests for the various requests (GetCapabilities, GetMap, etc). The wrapper script is basically to predefine a few things like the location of the map file that you might not want to normally expose to the end user. There are situations in which you might want to customize ...


3

Have you tried to use this gem in your Rails application? https://github.com/sourcepole/ruby_mapscript From the documentation: Ruby MapScript API extensions This gem extends the SWIG MapScript API of UMN MapServer with Ruby-like > iterators and other API methods.


3

I just faced the same problem and solved it by copy the mapscript.py and _mapscript.so into my virtual env. cd venv/lib/python2.7/site-packages cp /usr/lib/python2.7/dist-packages/_mapscript.so . cp /usr/lib/python2.7/dist-packages/mapscript.py . At least the following script in a python web-app worked fine, based on the mapserver demo files I got here. .....


3

You do not need mapscript to achieve what you want. Simply use the mapserv cgi to publish the layers as WMS and then consume the WMS services from a OpenLayers-powered web page.


3

I am a mapserver developer and I have just committed a patch that should solve this issue. See changeset r12309 for the details.


3

You are doing it right and 1 is the status code (SUCCESS). Below is a complete (working) example of queryByShape implemented in Java mapscript (for a vector layer). Translating the sample into python should be a piece of cake, but I'm not sure how it works with raster layers. /** * query a single layer by specifying a shape (in map coordinates). * * @...


2

I use a similar approach in Python with MapScript on Windows and it works fine. Careful with the following code: pathVariable += MY_PATH_VARS Environment.SetEnvironmentVariable("PATH", MY_PATH_VARS) I believe it should be: pathVariable += MY_PATH_VARS Environment.SetEnvironmentVariable("PATH", pathVariable) I'd look at the C# sourcecode for ...


2

EPIC FAIL: I apologize, I just found out that the documentation I mentioned is not up to date. The correct API (taken from the swig interface file) is the following: shape=layer.getShape(result) where result is the resultObj returned by getResult. Opened ticket and updated documentation (will go live soon). DOCUMENTATION mentioned in the answer below IS ...


2

I would suggest looking into several options: Google Fusion Tables. Great way to import spreadsheet data with coordinates (or addresses), and display on a map. Exporting to KML I believe is an option. MapBox. Lots of big data implementations currently in the wild. http://mapbox.com/showcase/#bigdata ArcGIS Explorer Online (ESRI). From a big commercial ...


2

Your layers projection in the mapscript is different from the msv layers projection in OpenLayers, could it be the problem? I would use epsg:4326 everywhere


2

I found that there actually is a method for querying by Index in the layerObj $layerObj->queryByIndex(???, $fid) where ??? is probably the tileIndex of a layer object. Maybe I missed it in the documentation, but I am pretty sure that it is not there. I only found a int queryByIndex(....) in the mapObj section, but none in the layerObj section of the ...


2

Ok, this is not really a GIS related but rather a programming related question. Anyway, for your intended purpose you can use almost any language you like. Here is a very, very simple PHP script based on the example Mapfile from the documentation at http://www.mapserver.org/mapscript/php/by_example.html. In this script only the variable DATA is altered: <...


2

Since you posted your question MapServer for Windows (MS4W) have released a new version, which provides version 7 of MapServer, and MapScript support for PHP, Python, Java, and CSharp. An alternative source of Windows Binaries for MapServer (with Mapscript support) can be found from GISInternals


2

And as always predictably happens...... About an hour after I post the question, I end up answering it and finding a solution. It turns out, all I needed to add to my constructor was the following map.maxExtent = new OpenLayers.Bounds(0,0,700000,1300000); This was added just after setting the map projection as follows function init() { map = new ...


2

You need to load "phpmapscript extension", if you're using php 5.2, you can use dl() function before phpinfo(), if your php are 5.3 of newer you need search to enable or use it.


2

From a clean Ubuntu 12.04 Precise install I was able to get it to work with this: echo 'deb http://ppa.launchpad.net/ubuntugis/ppa/ubuntu precise main' | sudo tee -a /etc/apt/sources.list echo 'deb-src http://ppa.launchpad.net/ubuntugis/ppa/ubuntu precise main' | sudo tee -a /etc/apt/sources.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ...


2

Thanks to @interactivegis.com for answer on MS4W-mailing list Hi Kenneth, The example code we sent out earlier today actually helps with this as well. The IDs are now in the layer object, so after you get the $layer and get a shape using the layerObj Methods (like queryBy or nextShape or whatever from https://www.mapserver.org/mapscript/mapscript.html#...


1

Finally I got it, it seems that getAllLayerNames and getLayersDrawingOrder have the same order. So here is my code: $allLayers = $oMapFinal->getAllLayerNames(); foreach ($allLayers as $index => $evalLayer){ $layer = $oMapFinal->getLayerByName($evalLayer); if($layer == MY CONDITION) { $arrLayOrder = $oMapFinal->...


1

With PHP-MapScript, you can get all layer names as an array. You can make an array of the layers wish to enable, using the layer name. This is not the most elegant solution, and there is likely a better method supported through the API, but quick and dirty you can just step through the entire list of layers and disable them and only enable the ones you want....


1

I didn't find any compiled php_mapscript for any current PHP as well, so I tried to compile it myself. Took me long time and a lot of failures but I did it. Don't know if you need this any more since your post is more than one year old but I have php_mapscript.dll built against php-5.6.27-win32-vc11-ts-x86 and Mapserver-7.0-vc11-x86 (stable branch package ...


1

Installing PostGIS 2.1 and PostgreSQL 9.3 on Ubuntu 12.04 etc. from the PostgreSQL Apt Repository can be found here: http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt


1

$layer = $map->getLayerByName('layername'); //set an attribute value $layer->set('data', '/path/to/my/shape/file.shp'); or $layer = $map->getLayer('layer_index'); //integer! //set an attribute value $layer->set('data', '/path/to/my/shape/file.shp');


1

The answer is no. Mapscript and the mapfile are executed on the server and they have nothing to do with the OpenLayers client-side JavaScript. What you are requesting with OpenLayers.Layer.WMS is a set of images and metadata and by the time these get to the browser there is not much you can manipulate. Mapscript can be useful if you need to do lots of ...


1

I cannot comment on the answer which is a great answer, but wanted to add that I believe with 7.0 now you have to add a $map var in the query like: $layer->queryByIndex($map, 0, $myFID);


1

You might want to look into FME Server (Safe Software) as well. It can upload, process, tranform, reproject, and download in to pretty much any common format. It also has some very cool functions such as email/sms notifications and on demand feature streaming. Good luck!


1

I've been having the same problem when trying to create a new CLASS object. I've logged it as a bug as the SWIG wrappers seem incorrect for both layerObj and classObj. The args variable is defined in neither: def __init__(self, map = None): this = _mapscript.new_layerObj(map) try: self.this.append(this) except: self.this = this if 1: ...


1

Its basically telling you whats wrong- you have not 'opened' the layer Try this: if (resultado.numresults > 0) { // Open layer layerUtbs.open(); // here i got a error (you shouldn't now);. layerUtbs.getFeature(resultado.getResult(0).shapeindex, resultado.getResult(0).tileindex); ...


Only top voted, non community-wiki answers of a minimum length are eligible