Earn 600$ by Clicking on each Ad


Thursday, March 5, 2009

Geography Markup Language

The Geography Markup Language (GML) is the XML grammar defined by the Open Geospatial Consortium (OGC) to express geographical features. GML serves as a modeling language for geographic systems as well as an open interchange format for geographic transactions on the Internet. Note that the concept of feature in GML is a very general one and includes not only conventional "vector" or discrete objects, but also coverages (see also GMLJP2) and sensor data. The ability to integrate all forms of geographic information is key to the utility of GML.

GML Model

The original GML model was based on the World Wide Web Consortium's Resource Description Framework (RDF). Subsequently, the OGC introduced XML schemas into GML's structure to help connect the various existing geographic databases, whose relational structure XML schemas more easily define. The resulting XML-schema-based GML retains many features of RDF, including the idea of child elements as properties of the parent object (RDFS) and the use of remote property references.

GML contains a rich set of primitives which are used to build application specific schemas or application languages. These primitives include:

Monday, March 2, 2009



PostGIS is an extension for PostgreSQL RDBMS that spatially enables it for storing GIS content.

It could be considered something similiar to Esri ArcSDE or Oracle Spatial.
In fact PostGIS is for PostgreSQL what is Esri ArcSDE for Oracle, MS SQL Server, Informix, DB2.

PostGIS is OGC compliant and is Open Source, released under the GNU General Public License.

For more info about PostGIS you can take a look here.

Create POSTGIS Database

First create the PostgreSQL database, using PostgreSQL in the command window or the pgAdmin III SQL window, typing:

WITH OWNER = psqluser
TABLESPACE = pg_default;

After creating the database you have to enable it for storing, with PostGIS, the geographic information.
For doing so you have to enable PL/pgSQL procedural language extension.

You have to use the createlang command (under Windows use the command prompt, under the PostgreSQL’s bin folder):

createlang plpgsql -U psqluser -D TUTORIAL

Now you can succesfully load the PostGIS objects and functions by the lwpostgis.sql script.

psql -U psqluser -d TUTORIAL -f lwpostgis.sql

After doing so, you can see that a lot of object and functions are now loaded in TUTORIAL database.

This objects and functions are necessary for PostGIS to work.

Load Data In POSTGIS

There are several ways in order to load geometry objects in PostGIS.

It is possible to load data using SQL, or using the Loader utility (shp2pgsql command, similiar to the shp2sde command for ArcSDE). In fact the loader utility is a command that will generate the SQL with the INSERT statment to load geometries in PostGIS.

Let’s see this two ways.

1. Load Data In POSTGIS Using SQL

Create a table named TEST:

CREATE TABLE "test" ("id" int4, "name" varchar(20));
SELECT AddGeometryColumn('','test','the_geom', '-1', 'LINESTRING',2);

Let’s load the first linestring gis object in this table, using the GeomFromText function:

INSERT INTO "test" ("id","name","the_geom") VALUES (1, 'First Geometry', GeomFromText('LINESTRING(1 1,2 2,3 3,3 4)'));

Let’s retrieve this GIS object with the database:

SELECT id, name, the_geom FROM TEST;

> 1;"First Geometry";"01020000..."

As we can notice, the geometry information with a simple SELECT statment is retrieved as is stored in PostGIS database: as a binary string.

If we wan’t to retrieve the geometry information as a simple Open GIS Well Known Text Format string, we can use another function that was created in the TUTORIAL database by the lwpostgis.sql script: AsText

SELECT id, name, AsText(the_geom) FROM TEST;

> 1;"First Geometry";"LINESTRING(1 1,2 2,3 3,3 4)"

2. Load data (shapefiles) in PostGIS using the shp2pgsql command

To load shapefiles in PostGIS database you can use the Loader utility: the shp2pgsql command (under bin’s folder). This utility simply creates from any shapefile an sql file that can be used in PostGIS to load the shapefile in the database.

We will now load the tutorial’s shapefiles (compfun.shp, poi.shp, vestizioni.shp, zone.shp) into the TUTORIAL database we created with PostGIS.

First we will use the shp2pgsql command to produce the sql files:

shp2pgsql C:\training\mapServerTutorial\data\poi.shp poi > C:\training\mapServerTutorial\data\poi.sql
shp2pgsql C:\training\mapServerTutorial\data\compfun.shp compfun > C:\training\mapServerTutorial\data\compfun.sql
shp2pgsql C:\training\mapServerTutorial\data\vestizioni.shp vestizioni > C:\training\mapServerTutorial\data\vestizioni.sql
shp2pgsql C:\training\mapServerTutorial\data\zone.shp zone > C:\training\mapServerTutorial\data\zone.sql

Now we can use the 4 sql files produced with PostGIS: these sql files will phisically load the shapefile geometries in 4 PostGIS tables.

Executing the poi.sql script will create in TUTORIAL database the poi table:

CREATE TABLE "poi" (gid serial PRIMARY KEY, "poi_time" varchar, "poi_user" varchar);
SELECT AddGeometryColumn('','poi','the_geom','-1','POINT',2);
INSERT INTO "poi" ("poi_time","poi_user",the_geom) VALUES ('04/08/2006, 16.23.41','Paolo','0101000000713D0A170A7A3141B81E853B33DB5041');
INSERT INTO "poi" ("poi_time","poi_user",the_geom) VALUES ('04/08/2006, 16.24.09','Paolo','01010000005C8FC2D5FB79314152B81E9971DB5041');

Executing the compfun.sql script will create in TUTORIAL database the compfun table:

CREATE TABLE "compfun" (gid serial PRIMARY KEY, "objectid" int8, "codarea" int8, "shape_area" numeric, "shape_len" numeric);
SELECT AddGeometryColumn('','compfun','the_geom','-1','MULTIPOLYGON',2);
INSERT INTO "compfun" ("objectid","codarea","shape_area","shape_len",the_geom) VALUES ('4052','2801','3.45349032455e+006','8.16732468815e+003','0106000000010000000103000000010000001D00000040996FAA397B3141E07CD98012DC50414016BF4B637B314120EDD71DF2DB5041C0C48863797C3141C026D7070CDC5041C08D9B964B7D3141C040084D8DDB504100750AE32F7B3141102BE15F19DB5041809E6B9AC87A3141906226D602DB504180B38C4A967931410077244BC0DA504100CCFE59B177314160708AEE51DA504180DD9DBA9F76314100C6939B17DA5041C04FAAF651763141706CA3D154DA504140EF3C1B8E7531411049C4A0EFDA5041003A43365D753141004DABBDECDA5041000172392C753141B0E26CBB34DB5041C080CC767F743141F057440D93DB5041402243CBBE74314110CE02459ADB5041003E9495AA743141603B417EA6DB5041C04DC6C64E753141E05D04A8BADB5041402243CBBE7431416060D6F125DC5041C080CC767F743141C0C546F137DC5041809068EA7374314150E422FE4EDC5041805FFBE4EC743141B00EB4615DDC5041403275FC62753141F05CE8A069DC504100C2B632047631414029A95177DC504140BA7EB6B97631419096E78A83DC5041C094C6072A773141C0A93C2E8CDC50410017E6B7897931416003F8D6A6DC504100DC11CE5E7A3141A0551333B0DC5041C0B399BBFB7A3141D0664F850DDC504140996FAA397B3141E07CD98012DC5041');

Executing the vestizioni.sql script will create in TUTORIAL database the vestizioni table:

CREATE TABLE "vestizioni" (gid serial PRIMARY KEY, "objectid" int8, "codarea" int8, "classe" int4, "tipo" int4, "cod" int4, "origine" int4, "shape_len" numeric);
SELECT AddGeometryColumn('','vestizioni','the_geom','-1','MULTILINESTRING',2);
INSERT INTO "vestizioni" ("objectid","codarea","classe","tipo","cod","origine","shape_len",the_geom) VALUES ('89833','2801','8','1','801','2','2.14449030864e+001','010500000001000000010200000002000000403738813D7C3141A08D27B907DC5041800BC76B457C314190779DBD02DC5041');
INSERT INTO "vestizioni" ("objectid","codarea","classe","tipo","cod","origine","shape_len",the_geom) VALUES ('89834','2801','8','1','801','2','5.51685811591e+000','01050000000100000001020000000200000040DFB2743B7C3141B0E4FA0009DC5041403738813D7C3141A08D27B907DC5041');
INSERT INTO "vestizioni" ("objectid","codarea","classe","tipo","cod","origine","shape_len",the_geom) VALUES ('89835','2801','8','1','801','2','9.23513291375e+000','01050000000100000001020000000200000040CB8C02387C3141C0C057250BDC504140DFB2743B7C3141B0E4FA0009DC5041');
other omitted INSERT statments...


Executing the zone.sql script will create in TUTORIAL database the zone table:

CREATE TABLE "zone" (gid serial PRIMARY KEY, "objectid" int8, "codarea" int8, "classe" int4, "tipo" int4, "cod" int4, "numlott" int8, "lottoid" numeric, "shape_area" numeric, "shape_len" numeric);
SELECT AddGeometryColumn('','zone','the_geom','-1','MULTIPOLYGON',2);
INSERT INTO "zone" ("objectid","codarea","classe","tipo","cod","numlott","lottoid","shape_area","shape_len",the_geom) VALUES ('46929','2801','1','7','107','117','2.80111700000e+006','5.68543477776e+003','3.01854931948e+002','0106000000010000000103000000010000000700000040900304607A3141900DF7EA83DB5041C0D4C76B7C7A3141205BC65C72DB5041C0E425CB7C7A314120791E9271DB5041C0E80CE8797A3141201B4EDF70DB5041803FC859407A3141F018096069DB5041C07A13F7207A314160903B487DDB504140900304607A3141900DF7EA83DB5041');
INSERT INTO "zone" ("objectid","codarea","classe","tipo","cod","numlott","lottoid","shape_area","shape_len",the_geom) VALUES ('46935','2801','1','7','107','110','2.80111000000e+006','6.65516688758e+003','3.94268253922e+002','01060000000100000001030000000100000007000000008FFB54307A314140C89894A1DB504180AF5AF5427A314100B92A0E96DB5041408C671FB9793141B0F4188D88DB50410008CE1BAD793141E063DA5990DB5041C03447E0D4793141F070036194DB5041C0C0EC31CF7931411030BA1498DB5041008FFB54307A314140C89894A1DB5041');
INSERT INTO "zone" ("objectid","codarea","classe","tipo","cod","numlott","lottoid","shape_area","shape_len",the_geom) VALUES ('46937','2801','1','7','107','116','2.80111600000e+006','7.15624610182e+003','3.39270025503e+002','01060000000100000001030000000100000005000000C07A13F7207A314160903B487DDB5041803FC859407A3141F018096069DB5041C02DDE73F8793141C0A7E30960DB50410009F5D4D679314140E3658775DB5041C07A13F7207A314160903B487DDB5041');
other omitted INSERT statments...


Sunday, January 18, 2009

Interview Questions For GIS

1. GIS is a highly technical, cutting edge technology. As a member of the IT community, how do you stay current with changes in GIS and technology?

2. You have been given a text file consisting of miscellaneous data including names, addresses, and X-Y coordinates. How would you input this data into a GIS?

3. What is the difference between CAD and GIS? What would an appropriate use be for either?

4. What is a projection? How is a projection changed using ARCINFO or ArcView?

5. How do raster and vector data differ, and give an example of each?

6. How would you copy a file from a network location in a Windows environment?

7. What is Heads-Up Digitizing?

8. What is a variable?

9. What is the difference between a Union and an Intersect function?

10. Given a database with a “Last Name” Field, describe a SQL statement that selects all people with the last name of Smith.

11. What file is required to properly display a TIFF Image in the correct coordinate space?

12. Given a Future Land Use coverage or shapefile, how could you calculate the acreages by Land Use type? Assume that there is a field called “acreage.”

13. A data request for eagle nest locations has been given to you. How do you go about locating the data?

14. How do you set an environment variable in Windows NT, 9x or any programming language?