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

Ines mleonsoft at yahoo.com.ar
Mon Nov 13 08:34:48 EST 2006


Hi,

Sorry for my late answer. I was waiting for the answer from my partner.
Well, there is some several changes for the work I have to do.

1)The database will not be a database, it will be an XML file with tabular
data, so, I have to exctract the information from this file.

2) I don´t have to show the descriptions in a drop down list, I have to make
a "search", I think in a form. So, in my application, I have to put the name
of the specie (description) and when I click "submit" it will connect with a
webservice that will generate the XML file. This XML file will contain the
latitude and longitude of that specie.

3)Every specie will have just ONE latitude and longitude.

4) And then, I have to show this point in the map.

* Now I ask, Is it possible with chameleon? Read tabular data from an XML
file?

I changed some things in my widget for the "search" in the function
DrawPublish() but it doesn't work because when I run my application it goes
directly to "xx":
$szReturn = "<form name='form1' method='post' action='xx'>Search by
scientific name <input type='text' name='textfield'><input type='submit'
name='Submit'></form>";

I send you a part of the XML file:

<record>
  <darwin:DateLastModified>2006-10-26TCentral Ame:rica Standard
Time</darwin:DateLastModified>
  <darwin:InstitutionCode>HULE</darwin:InstitutionCode>
  <darwin:CollectionCode>Plantae</darwin:CollectionCode>
  <darwin:CatalogNumber>100899</darwin:CatalogNumber>
  <darwin:ScientificName>Inga densiflora</darwin:ScientificName>
  <darwin:BasisOfRecord>S</darwin:BasisOfRecord>
  <darwin:Kingdom xsi:nil="true" />
  <darwin:Phylum xsi:nil="true" />
  <darwin:Class xsi:nil="true" />
  <darwin:Order xsi:nil="true" />
  <darwin:Family>Fabaceae</darwin:Family>
  <darwin:Genus>Inga</darwin:Genus>
  <darwin:Species xsi:nil="true" />
  <darwin:Subspecies xsi:nil="true" />
  <darwin:ScientificNameAuthor>Benth.</darwin:ScientificNameAuthor>
  <darwin:IdentifiedBy />
  <darwin:YearIdentified xsi:nil="true" />
  <darwin:MonthIdentified xsi:nil="true" />
  <darwin:DayIdentified xsi:nil="true" />
  <darwin:TypeStatus xsi:nil="true" />
  <darwin:CollectorNumber>1322</darwin:CollectorNumber>
  <darwin:FieldNumber xsi:nil="true" />
  <darwin:Collector />
  <darwin:YearCollected>1983</darwin:YearCollected>
  <darwin:MonthCollected>4</darwin:MonthCollected>
  <darwin:DayCollected>30</darwin:DayCollected>
  <darwin:JulianDay xsi:nil="true" />
  <darwin:TimeOfDay xsi:nil="true" />
  <darwin:ContinentOcean xsi:nil="true" />
  <darwin:Country>Nicaragua</darwin:Country>
  <darwin:StateProvince xsi:nil="true" />
  <darwin:County xsi:nil="true" />
  <darwin:Locality>Quipó</darwin:Locality>
  <darwin:Longitude>-85.044167</darwin:Longitude>
  <darwin:Latitude>13.627778</darwin:Latitude>
  <darwin:CoordinatePrecision xsi:nil="true" />
  <darwin:MinimumElevation>320</darwin:MinimumElevation>
  <darwin:MaximumElevation>320</darwin:MaximumElevation>
  <darwin:MinimumDepth xsi:nil="true" />
  <darwin:MaximumDepth xsi:nil="true" />
  <darwin:Sex xsi:nil="true" />
  <darwin:PreparationType xsi:nil="true" />
  <darwin:IndividualCount xsi:nil="true" />
  <darwin:PreviousCatalogNumber xsi:nil="true" />
  <darwin:RelationshipType xsi:nil="true" />
  <darwin:RelatedCatalogItem xsi:nil="true" />
  <darwin:Notes xsi:nil="true" />
  </record>

Thank you very much for your help again, if you need another information
tell me and I will send you every thing you need.
Thank you again
Ines




-----Mensaje original-----
De: Julien-Samuel Lacroix [mailto:jlacroix at mapgears.com]
Enviado el: domingo, 05 de noviembre de 2006 20:07
Para: Ines
CC: chameleon at lists.maptools.org
Asunto: [Bulk] Re: [Chameleon] Drawing points with latitude and
longitude - Please help me


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