2010/08/09

Where do I find my EPSG code?

There is a text file “epsg” in your PROJ4 installation (/usr/share/proj/epsg) which contain the EPSG information used by PROJ4. In Windows, this is often located in C:\proj\nad or is found with an environment variable called PROJ_LIB.

Hehe

Why doesn’t PIL (Python Imaging Library) open my PNGs?

PIL does not support interlaced PNGs at this time (no timetable on when it actually will either). To be able to read PNGs in PIL, they must not be interlaced. Modify your OUTPUTFORMAT with a FORMATOPTION like so:

OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
FORMATOPTION "INTERLACE=OFF"
END

Hehe

Which image format should I use?

Although MapScript can generate the map in any desired image format it sufficient to only consider the three most prevalent ones: JPEG, PNG, and GIF.

JPEG is an image format that uses a lossy compression algorithm to reduce an image’s file size and is mostly used when loss of detail through compression is either not noticeable or negligible, as in most photos. Maps on the other hand mainly consist of fine lines and areas solidly filled in one colour, which is something JPEG is not known for displaying very well. In addition, maps, unless they include some aerial or satellite imagery, generally only use very few different colours. JPEG with its 24bit colour depth capable of displaying around 16.7 million colours is simple not suitable for this purpose. GIF and PNG however use an indexed colour palette which can be optimized for any number (up to 256) of colours which makes them the perfect solution for icons, logos, charts or maps.

Although GIF shows a quantitative as well as qualitative advantage over PNG when generating maps that contain full coloured remote sensing imagery, PNG is the clear quantitative winner in terms of generated file sizes for maps with or without additional monochrome imagery and should therefore been the preferred image format. If the mapping application however can also display fullcolour aerial or satellite imagery, the output file format can be changed dynamically to either GIF or even PNG24 to achieve the highest possible image quality.

Hehe

How do I set line width in my maps?

You must set the symbol for the LAYER to be ‘circle’ and then you can set the symbol SIZE to be the width you want. A ‘circle’ symbol can be defined as

SYMBOL
NAME 'circle'
TYPE ELLIPSE
FILLED TRUE
POINTS 1 1 END
END

Hehe

Does MapServer Support Geocoding?

No.

Geocoding is an activity where you take a list of addresses and generate lat/lon points for them. This kind of spatial functionality is provided by proprietary packages such as the ESRI suite of tools, as well as services such as those provided by GDT. MapServer is for map rendering, and it does not provide for advanced spatial operations such as this.

If you are using MapScript, there is a free geocder available through XMLRPC and SOAP at http://geocoder.us . You could hook you application up to use this service to provide lat/lon pairs for addresses, and then use MapServer to display those points.

Hehe

Does MapServer Support Reverse Geocoding?

No.

Reverse geocoding is an activity where you take a list of street features that you already have and generate postal addresses from them. This kind of spatial functionality is provided by proprietary packages such as the ESRI suite of tools, as well as services such as those provided by GDT. MapServer is for map rendering, and it does not provide for advanced spatial operations such as this.

Hehe

2010/08/07

What’s with MapServer’s logo?

The MapServer logo illustrates the confluence of the Minnesota and Mississippi rivers, quite near to the home of the St. Paul Campus of the University of Minnesota, which was the birthplace of MapServer.

Hehe

2010/08/02

Restart Apache

Try

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
or
sudo /etc/init.d/apache2 restart

hehe

2010/07/22

Rasters and Tile Indexing



When handling very large raster layers it is often convenient, and higher performance to split the raster image into a number of smaller images. Each file is a tile of the larger raster mosaic available for display. The list of files forming a layer can be stored in a shapefile with polygons representing the footprint of each file, and the name of the files. This is called a TILEINDEX and works similarly to the same feature in vector layers. The result can be represented in the MAP file as one layer, but MapServer will first scan the tile index, and ensure that only raster files overlapping the current display request will be opened.

The following example shows a simple example. No DATA statement is required because MapServer will fetch the filename of the raster files from the Location attribute column in the hp2.dbf file for records associated with polygons in hp2.shp that intersect the current display region. The polygons in hp2.shp should be rectangles representing the footprint of the corresponding file. Note that the files do not have to be all the same size, the formats can vary and they can even overlap (later files will be drawn over earlier ones); however, they must all be in the same coordinate system (projection) as the layer.
LAYER
  NAME "hpool"
  STATUS ON
  TILEINDEX "hp2.shp"
  TILEITEM "Location"
  TYPE RASTER
END
The filenames in the tileindex are searched for relative to the SHAPEPATH or map file, not relative to the tileindex. Great care should be taken when establishing the paths put into the tileindex to ensure they will evaluate properly in use. Often it is easiest to place the tileindex in the SHAPEPATH directory, and to create the tileindex with a path relative to the SHAPEPATH directory. When all else fails, absolute paths can be used in tileindex, but then they cannot be so easily moved from system to system.

While there are many ways to produce TILEINDEX shapefiles for use with this command, one option is the gdaltindex program, part of the GDAL utility suite. The gdaltindex program will automatically generate a tile index shapefile from a list of GDAL supported raster files passed on the command line.
Usage: gdaltindex [-tileindex field_name] index_file [gdal_file]*
% gdaltindex doq_index.shp doq/*.tif


hehe

Menginstall gdaltindex pada Ubuntu

Untuk menginstall gdaltindex pada Ubuntu, ketikkan perintah berikut ini.

sudo apt-get install gdal-bin

hehe

How to Open a RAR File

Untuk mengekstrak RAR file dapat menggunakan command berikut ini.


unrar x filename.rar

hehe

2010/04/17

Jogja Map

Mari kita lihat peta Jogja berikut ini.

Silakan klik peta-nya untuk tampilan yang lebih besar.






















Kota Jogja dikelilingi oleh ringroad, berfungsi untuk memutari kota Jogja dari luar. Jika tidak ingin terjebak kemacetan di Jogja, silakan lewat ringroad ini.

Hehe.

2010/04/12

Steve Jobs' Speech

Pidato yang diucapkan Steve Jobs di upacara wisuda Stanford University bisa dilihat di video di bawah ini (ada transkripnya).



Stay hungry, stay foolish ...

Hehe

2010/03/30

MIT Style License

 Lisensi MapServer adalah MIT Style License yang berbunyi seperti di bawah ini.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies of this Software or works derived from this Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 Hehe

MapServer 5.4.2 Revision History

  • Fixed PHP/Mapscript to support PHP 5.3
  • New fix for incomplete CVE-2009-0840 security fix made in 5.4.
  • Add centroid geomtransform
  • Fixed performance bottleneck when computing a polygon center of gravity for label point computation
  • Save ALIGN parameter if it is set to CENTER or RIGHT
  • PHP: add a getResults method on the layer object
Hehe

2010/02/18

Agar Label Tidak Terpotong

Agar label tidak terpotong, konfigurasi mapfile adalah sebagai berikut.

WEB
    METADATA
        "labelcache_map_edge_buffer" "-100"
    END
END
CLASS
    LABEL
        PARTIALS FALSE
    END
END

Hehe

EPSG:4326

EPSG:4326 is a common coordinate reference system that refers to WGS84 as (latitude, longitude) pair coordinates in degrees with Greenwich as the central meridian.

Proyeksi Google Maps

Proyeksi Google Maps adalah sebagai berikut.

PROJECTION
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgri...@null +no_defs"
END

Hehe

MS4W

MS4W berisi:
- Apache HTTP Server version 2.2.14
- PHP version 5.3.1
- MapServer CGI 5.6.1
- MapScript 5.6.1 (CSharp, Java, PHP, Python)
- Includes support for Oracle 11g, and SDE data (if you have associated client/dlls)
- MrSID support built-in
- GDAL/OGR 1.7.0 and Utilities
- MapServer Utilities
- PROJ Utilities
- Shapelib Utilities
- Shp2tile Utility
- Shpdiff Utility
- AVCE00 Utilities
- OGR/PHP Extension 1.0.0
- OWTChart 1.2.0

Hehe

Tighten Control of Access to Mapfiles and Templates

MapServer versions 5.2.1 and older could potentially be used to access arbitrary files via the creation of mapfiles or templates in untrusted directories.

The new access control mechanisms will be implemented and released in MapServer 5.4.0, 5.2.2 and 4.10.4.

Technical Solution


The following mechanisms will be put in place:
- Enforce the requirement for the MAP keyword at the beginning of mapfiles and for the SYMBOLSET keyword at the beginning of SYMBOLSETs.
- Require a Magic String at the beginning of all MapServer templates
- Use of environment variables to control and restrict access to mapfiles by the mapserv CGI: MS_MAP_PATTERN, MS_MAP_NO_PATH

Each of the points above are described in more details in the following sections.

Enforce the requirement for the MAP and SYMBOLSET keywords


The MAP and SYMBOLSET keywords used to be optional at the beginning of mapfiles and symbolsets respectively.

With this change, the MAP keyword will be required on the first line of mapfiles and the SYMBOLSET keyword required on the first line of symbolset files.

If the keyword is missing then the parser will reject the file.

Require a Magic String at the beginning of all MapServer templates


With this change, the first line of a template must contain the “MapServer Template” magic string which can be surrounded by comment delimiters in the format of the template to facilitate template editing (see examples below). The first line of the template file will automatically be stripped from the template and will not be included in the MapServer output.

If the magic string is not found then the template will be rejected by MapServer.

Tile Mode

Introduction


MapServer can feed tile-based map clients directly using the CGI “tile mode”. Tile-based map clients work by dividing the map of the world up into a discrete number of zoom levels, each partitioned into a number of identically sized “tiles”. Instead of accessing a map by requesting a bounding box, a tile client builds a map by accessing individual tiles.

Tile requests are handled by the ‘mapserv’ CGI program. In order to return tiles in the correct projection, MapServer must be built with the –use-proj option turned on. You can check if your version of ‘mapserv’ has projection support by running it with the ‘-v’ option and looking for ‘SUPPORTS=PROJ’.

MapServer requires that each LAYER in your map file have a valid PROJECTION block to support reprojection. Because the tile mode uses reprojection, you will have to ensure each LAYER has a valid PROJECTION block.

Configuration checklist:
- MapServer compiled with PROJ support
- Map file with a PROJECTION defined for every LAYER

Utilization


The MapServer tile support adds three new directives to the CGI interface:
- mode=tile tells the server to generate tiles based on the other tile mode parameters
- tilemode=gmap tells the server use the Google Maps tile scheme for the tiles
- tile=x+y+z tells the server what tile you want to retrieve, using the Google Maps tile addressing system
- tilemode=ve tells the server use the Virtual Earth tile naming scheme for the tiles
- tile=10231 tells the server what tile you want to retrieve, using the Virtual Earth tile addressing system

Skala Google Maps

Skala Google Maps per level adalah sebagai berikut.

z17 = 1:2250
z16 = 1:4500
z15 = 1:9000
z14 = 1:23000
z13 = 1:46000
z12 = 1:93000
z11 = 1:188000
z10 = 1:350000
z9 =1:725000
dst.

Hehe

How to Install GCC Compiler in Ubuntu

Install package called build-essential is the best way

build-essential contains a list of packages which are essential for building Ubuntu packages including gcc compiler, make and other required tools.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
gcc -v
make -v

How can I make my maps run faster?

There are a lot of different approaches to improving the performance of your maps, aside from the obvious and expensive step of buying faster hardware. Here are links to some individual howtos for various optimizations.

- Tuning your mapfile for performance
- Optimizing the performance of vector data sources
- Optimizing the performance of raster data sources
- Tileindexes for mosaicing and performance

msLoadMap(): Failed to open map file

Error displayed when trying to display map image.

The message tells you that MapServer cannot find mapfile. Verify that you have specified the correct path to the mapfile. Linux/Unix users should make sure that the web user has access permissions to the mapfile path as well.

msSaveImageGD(): Unable to access file

Error displayed when attempting to display map image.

This error is displayed if MapServer cannot display the map image. There are several things to check:

- IMAGEPATH and IMAGEURL parameters in mapfile are valid
- In CGI mode, any IMAGEPATH and IMAGEURL variables set in the init pages are valid
- Linux/Unix users should verify that the web user has permissions to write to the IMAGEPATH

AGG Rendering Specifics

MapServer 5.0 released with a new rendering backend.

Setting the OutputFormat


24 bit png (high quality, large file size):

OUTPUTFORMAT
    NAME 'AGG'
    DRIVER AGG/PNG
   IMAGEMODE RGB
END

24 bit png, transparent background:

OUTPUTFORMAT
    NAME 'AGGA'
    DRIVER AGG/PNG
    IMAGEMODE RGBA
END

24 bit jpeg (jpeg compression artifacts may appear, but smaller file size):

OUTPUTFORMAT
    NAME 'AGG_JPEG'
    DRIVER AGG/JPEG
    IMAGEMODE RGB
END

png output, with number of colors reduced with quantization.

OUTPUTFORMAT
    NAME 'AGG_Q'
    DRIVER AGG/PNG
    IMAGEMODE RGB
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "QUANTIZE_COLORS=256"
END

New Features


All rendering is now done antialiased by default. All ANTIALIAS keywords are now ignored, as well as TRANSPARENCY ALPHA. Pixmaps and fonts are now all drawn respecting the image’s internal alpha channel (unless a backgroundcolor is specified).

As with GD in ver. 4.10, using a SYMBOL of type ELLIPSE to draw thick lines isn’t mandatory anymore. To draw a thick line just use:

STYLE
    WIDTH 5
    COLOR 0 0 255
END

A line symbolizer has been added, that works with vector or pixmap symbols, to draw textured lines. This happens by default if a line’s style is given a symbol of type vector or pixmap. To enable “shield” symbolization, i.e. a marker placed only on some points of the line, you must add a GAP parameter to your symbol definition. This GAP value is scaled w.r.t the style’s SIZE parameter. Specify a positive gap value for symbols always facing north (optionally rotated by the ANGLE of the current style), or a negative value for symbols that should follow the line orientation

This happens by default if a line’s style is given a symbol of type vector or pixmap. To enable “shield” symbolization, i.e. a marker placed only on some points of the line, you must add a GAP parameter to your symbol definition. This GAP value is scaled w.r.t the style’s SIZE parameter - specify a positive gap value for symbols always facing north (optionally rotated by the ANGLE of the current style), or a negative value for symbols that should follow the line orientation

Pixmap and font symbols can now be rotated without loosing their transparency

For POLYGON layers with no specific SYMBOL, the WIDTH keyword specifies the width of the outline, if an OUTLINECOLOR was specified. This is a shorthand that avoids having to create multiple styles for basic rendering, and will provide a marginal performance gain. Note that in this case, the width of the outline is /not/ scale dependent.

Modified Behavior


When specifying a SYMBOL for a polygon shape, the GAP parameter of the symbol is used as a separation between each rendered symbol. This works for symbols of type vector, pixmap and ellipse. For example a symbol defined by

SYMBOL
    NAME 'triangle'
    TYPE VECTOR
    FILLED TRUE
    POINTS
        0 1
       .5 0
        1 1
        0 1
    END
    GAP 1
END

GD Won't Complie Against libpng 1.4.0

From the libpng README.

"Removed the deprecated png_check_sig() function/macro."

The file ext/gd/libgd/gd_png.c currently uses this function and so will not compile against libpng 1.4.0. The libpng man page notes the following:

"The function png_check_sig(sig, num) was replaced with !png_sig_cmp(sig, 0, num). It has been deprecated since libpng-0.90."

Hehe

Sekilas Tentang Library yang Dibutuhkan Oleh MapServer

1. GD
GD adalah library grafik. GD dependencies terdiri dari zlib, libpng, FreeType, dan libJPEG, yang memungkinkan GD memiliki kemampuan untuk mengkompres image, merender image PNG, menggunakan font TrueType, dan merender image JPEG.

2. FreeType
FreeType adalah sebuah font-rendering engine. Tidak digunakan langsung oleh MapServer tetapi digunakan GD untuk merender font.

3. libJPEG
Untuk merender image JPEG.

4. libpng
Untuk merender image PNG.

5. zlib
Untuk kompresi data.

6. GDAL
Library translator untuk data raster. Memiliki kemampuan untuk mengimport georeferenced raster image.

7. OGR
Menyediakan akses untuk membaca dan menulis berbagai macam format vektor.

8. Proj4
Library untuk proyeksi kartografi.

9. shapelib
Library untuk membuat dan manipulasi shapefile.

10.libcurl
Untuk menyediakan WMS support.

11.PDFLib
Membuat output PDF.

Hehe

2010/02/17

List URL Untuk Mendownload Software yang Diperlukan Oleh MapServer

Berikut ini adalah list URL untuk mendownload software yang diperlukan oleh MapServer.

1. MapServer

2. GD

3. FreeType

4. libJPEG

5. libpng

6. zlib

7. GDAL

8. Proj.4

9. shapelib

Hehe

2010/01/21

Mode Insert pada vi

Untuk mengubah ke mode insert pada vi dapat menggunakan tombol a.

Hehe

Search pada vi

Untuk search pada vi bisa menggunakan slash.

/(keyword)ENTER

hehe

2010/01/12

Membuat Spatial Index untuk Shapefile

Kita dapat menggunakan command shptree untuk membuat spatial index untuk shape file.shptree ini menggunakan metode quadtree.

shptree namashapefile [depth]

Untuk depth disarankan antara 6 sampai 10.

Hehe