[Chameleon] Drawing points with latitude and longitude - Please help me

Julien-Samuel Lacroix jlacroix at mapgears.com
Sun Nov 5 18:06:45 EST 2006


Hi,

What is the database where you store your data?

Your steps are correct. Now on how to read the data, it depends on what 
is the database. If you are able to extract the species names, you 
should be able to extract the Lat/Lon too from the same place.

Once you have extracted the lat/lon, you will be able to plots points on 
the map fairly easily. There's several method to do that, but we must 
know what is the data format before. I would  say that the easiest way 
would be to use OGR directly from the mapfile, otherwise use inline 
features.

Once we'll know the data format, we may be able to help more.

List of OGR supported data format:
http://ogr.maptools.org/ogr_formats.html
Plus ODBC

How to add an inline feature:
                    $pt = ms_newPointObj();
                    $ln = ms_newLineObj();
                    $shp = ms_newShapeObj(MS_SHAPE_POINT);
                    $pt->setXY($x,$y);
                    $ln->add($pt);
                    $shp->add($ln);
                    $poLayer->addFeature($shp);

Hope that help

Julien

Ines wrote:
> Julien, thank you for your help again. I created the drop down list and I
> saw the Gmap example. But I´m not sure if I´m in the correct way. Now I
> explain exactly what I have to do.
> 
> I have this information:
> 
> Species(Description)	Latitude1	longitude1	Latitude2	longitude2	Latitude3
> longitude3
> 
> fish species           xxxxxx	       xxxxxxx	xxxxxxx	 xxxxxxx	  xxxxxx
> xxxxxxxx
> bird species           xxxxxxx	 xxxxxxx	xxxxxxx	xxxxxxx	  xxxxxx	 xxxxxxxx
> ........etc
> 
> 
> I have to show in a map the places where is every specie. Every specie are
> located in several places of the map. Like "Parks" in the GMap example. In
> the Gmap example, the parks are in several points of the map drawn with
> green color. I have to make the same. But, every specie have several
> latitudes and longitudes for indicate every point of the map where I have to
> draw every point (circle or another image) where is located the specie.
> 
> My idea is to place every specie (description) in a drop down list, and when
> I select one specie, draw in the map all the points where is located that
> specie. For example with a circle or another image.
> 
> I think It could be:
> 
> 1) Select the specie of the drop down list
> 2) Read all latitudes and longitudes of that specie
> 3) Take a layer where I will show that points (circles or another image)
> 4) Show in that layer all the points (latitudes and longitudes) where is
> located that specie.
> 
> So, I maked a new widget with the tutorial of chameleon, I have a layer
> ready to work in it (I duplicated a layer in the file .map for work in it
> without problems) and I maked a drop down list with your help in the new
> widget where I show the species (descriptions).
> 
> But I don't know how to read the latitudes and longitudes and from where.
> And how to draw the circles or another images to put in the map (or layer)
> that corresponds to every latitude and longitude of a specific specie (the
> specie I selected)
> 
> Again thank you very much!
> 
> Ines
> 
> 
> 
> -----Mensaje original-----
> De: Julien-Samuel Lacroix [mailto:jlacroix at mapgears.com]
> Enviado el: miércoles, 01 de noviembre de 2006 13:00
> Para: Ines
> CC: chameleon at lists.maptools.org
> Asunto: [Bulk] Re: [Chameleon] Add layers drawing points (circles) with
> latitude and longitude
> 
> 
> Hi,
> I'm not sure I understand everything you need so I'll give you some
> pointers and hope they are helpful. If not, do not hesitate to post some
> more details. BTW here's the mapscript documentation:
> http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class
> 
> You can also look at the GMap demo which I think may be included in
> MS4W. If not, you can find it here:
> http://www.maptools.org/ms4w/index.phtml?page=downloads.html
> under PHP/MapScript Sample Application
> 
> 1) If you want to display a drop down listsimply add in your
> DrawPublish() function the following:
> $szReturn = "<select
> name='myselect'><option>value1</option><option>value2</option></select>";
> return $szReturn;
> 
> 2) The following code is not tested and need to be adapted to your needs
> and application. In the ParseURL():
> if($this->isVarSet('myselect'))
> {
>      $oMap = $this->moMapObject->oMap;
>      $oLayer = $oMap->getLayerByName('myLayer');
>      $oLayer->set('status', MS_ON);
>      $oClass = $olayer->getClass(0);
>      $oClass->setExpression($this->getVar('myselect'));
> }
> 
> I hope it gives you an idea of how to do things.
> 
> Julien
> 
> Ines wrote:
> 
>>Normand, thank you very very much for your help. I created successfully my
>>new widget!!! I'm very happy really.
>>
>>Now, I need to add descriptions in the widget to display as a list, drop
>>down list or something to continue with my work. I'm making the steps that
>>Julien tell me to do it.
>>
>>I have my widget and I have the layer ready. Now I need to know how to do
>>this:
>>
>>1) display the descriptions in the widgets
>>2) set the EXPRESSION and status of the layer in the
>>mapfile with the description column value
>>
>>
>>In this mail (below) I explain what I have to do.
>>
>>
>>Thank you very much again
>>
>>Ines
>>
>>
>>-----Mensaje original-----
>>De: Julien-Samuel Lacroix [mailto:jlacroix at mapgears.com]
>>Enviado el: viernes, 20 de octubre de 2006 11:25
>>Para: Ines
>>Asunto: [Bulk] Re: [Chameleon] Add layers drawing points with latitude
>>and longitude
>>
>>
>>Hello,
>>There's no widget that do exactly that I think, but creating a new one
>>would be easy. I suggest you add a layer in your mapfile to display this
>>information. You can create widget that will display the descriptions
>>and once done will set the EXPRESSION and status of the layer in the
>>mapfile with the description column value.
>>
>>Check this link to create your own widget:
>>
> 
> http://chameleon-tiki.maptools.org/tiki-index.php?page=Developing+a+new+Cham
> 
>>eleon+Widget
>>
>>Julien
>>
>>
>>Ines wrote:
>>
>>
>>>Hello, I have a database with some latitudes and longitudes and
>>
>>description
>>
>>
>>>and I have to show that points in a layer (map).
>>>
>>>For example, the columns of the database:
>>>
>>>latitude		longitude	Description
>>>xxxxxxxxx         xxxxxxx     bird species
>>>xxxxxxxxx         xxxxxx      shark species
>>>
>>>I need to make that the people can select the description in some place of
>>>my aplication and the aplication show the map with a "circle" for example
>>>lacated in that latitude and longitude, and then, add that image (or
>>
>>layer)
>>
>>
>>>with that point in the main map. I saw an aplication that have a "button"
>>>called "WMS layers" that make some similar with the Map Browser but I
>>
>>don't
>>
>>
>>>know how it works.
>>>
>>>Thank you very much
>>>Ines
>>>
>>>_______________________________________________
>>>Chameleon mailing list
>>>Chameleon at lists.maptools.org
>>>http://lists.maptools.org/mailman/listinfo/chameleon
>>
>>
>>--
>>Julien-Samuel Lacroix
>>Mapgears
>>http://www.mapgears.com/
>>
>>_______________________________________________
>>Chameleon mailing list
>>Chameleon at lists.maptools.org
>>http://lists.maptools.org/mailman/listinfo/chameleon
> 
> 
> --
> Julien-Samuel Lacroix
> Mapgears
> http://www.mapgears.com/
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list