[Chameleon] add points directly from coordinates data in decimal-degrees/longitude-latitude and querying

Anand Akmanchi anandakmanchi at gmail.com
Tue Jun 3 09:03:24 EDT 2008


Hi Donny,

You can certainly put your points data in a single table in mysql

Step 1: you have to add a column of int auto_increment type and name it GID
Step 2: Add a column of type geometry
Step 3: lets say that you have two columns containing latitude and longitude
in degree decimals. you have to populate the geometry column by
concatenating the lat and long values and generate a point using the
pointfromtext function in mysql.

heres how you do it:
ALTER TABLE mypointstable ADD GID int(11) PRIMARY KEY AUTO_INCREMENT NOT
NULL;
ALTER TABLE mypointstable ADD GEOMETRY GEOMETRY NOT NULL;
UPDATE mypointstable SET GEOMETRY =
PointFromText(CONCAT('POINT(',mypointstable .longitude,' ',mypointstable
.latitude,')4326'));
/*========4326 is the EPSG code for WGS84 datum*/
/*========Add a spatial index to geometry field */
ALTER TABLE mypointstable ADD SPATIAL INDEX ( 'GEOMETRY' ) ;

Step 4: Use the mypointstable and define it accordingly in map file to view
it in ms4w.
also take a look at the url below
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?MySQL

Hope this helps
-- 
Dr. Anand Akmanchi
Lecturer in Geoinformatics
Department of Geography
University of Pune
========================================
"Man's mind, once stretched by a new idea, never regains its original
dimensions." - Oliver Wendell Holmes
========================================



On Tue, Jun 3, 2008 at 12:58 AM, donny wicaks <donnywicaks at yahoo.com> wrote:

> hello, my name is donny wicaksono, from indonesia
>
> i'm developing a web-gis, i use windows as operating system, i use ms4w
> 2.2.6 with apache 2.2.4, php 5.2.4 and chameleon 2.4.
> for database, i use mysql 2.6.0
>
> i have difficulties, and i really hope that i can get any help from any of
> you in this mailing list.
>
> this is what i have already done:
> 1. when you extract chameleon to your ms4w, so you have the samples of
> applications of chameleon.
> including the data (shapefiles, images), chameleon.map file, *.html for
> templates *.phtml, and chameleon.php.
>
> 2. i have data : a shapefile of a region (for the base map), and tabular
> data of points with coordinates in degree-minutes-seconds and other relevant
> data.
>
> 3. first, i convert the coordinates of the points into
> decimal-degree/longitude-lattitude manually by using ms-excel.
>
> 4. then by using arcview, i convert the points that are already in
> decimal-degree/longitude-latitude, into shapefile (shp)
>
> 5. then i modify the already existed chameleon.map. i eliminate all
> unnecessary layers and i add my own layers : my_base_map.shp, and several
> points.shp
> then i save chameleon.map as another name.
>
> 6. then i modify the already existed, for example: sample_enhanced.html and
> sanmple_enhanced.phtml and save them as other name.
>
> 7. for php file i use the already existed chameleon.php
> and i also have made the httpd_*.conf for it
>
> 8. and the web-gis is working fine! all the layers can be displayed on and
> off, all the navigation tools are working fine: zoom in, out, recenter, pan
> and so is the query/identify button.
>
>
>
> my difficulties are:
> 1. you can read my description above that i convert points data with
> coordinates into a shapefile and then put it in *.map file.
> then i realize that if i want to add some more points, then i will keep
> repeating the same procedures.
> i mean, i will have to make a new shapefile for every points that are added
> and then add the new shapefile (points.shp) to the *.map
> and the points are not supposed to become one layer, but a group of points
> become one layer, another group of layer become one layer, and so on. so i
> have five layers of points.
>
> 2. then it is related to the query process. when i convert the points in,
> let's say "points.shp", the database of the shapefile will be stored in
> "points.dbf".
> when i hit the query button / identify feature button in chameleon, the
> query result will display every data in "points.dbf".
> the data in "points.dbf" are only coordinates data and points_id
> while i have already develop the data in mysql in appropriate database
> management systems
>
>
>
> my questions are:
> 1. is there any way to make layers, that can be displayed on the web-gis
> (the map), from the points by using their coordinates data in
> decimal-degrees/longitude-latitude  that are stored in mysql?
> so i don't have to convert it first into shapefile (*.shp)
>
> if that can be done, what kind of modification i should do?
> if you know the coding for that, please write it also.
>
> what kind of code should i write in *.map file, *.php file, *.html file and
> *.phtml file in order to make the application works?
>
> 2. what code should i write to link the map with mysql database?
> where should i write that code? in *.map file, *.php file, *.html file and
> *.phtml file or in other file? maybe in querywidget.php? if so, what is the
> code?
>
> if this can be done, i'm sure that the query will become more dynamic. you
> will help me a lot!!
>
> i think it's all my question. i'm sorry if my post is too long, it's just
> because i want to explain competely about what i've done and what are my
> obstacles.
>
> i will appreciate any help and response from any of you
> i thank you before..
>
> regards,
> donny
>
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
>


-- 
Dr. Anand Akmanchi
Lecturer in Geoinformatics
Department of Geography
University of Pune
========================================
"Man's mind, once stretched by a new idea, never regains its original
dimensions." - Oliver Wendell Holmes
========================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20080603/1bd0b76b/attachment.html


More information about the Chameleon mailing list