POIs from XML

51 views
Skip to first unread message

obimaster

unread,
Jul 16, 2012, 2:40:56 AM7/16/12
to porp...@googlegroups.com
HI

For a project i have to load some POIs from a XML file. There are many tutorials how to read XMLs with PHP but my Problem is, that I don´t know how to create the POIs. I want to make a loop which adds a POI for each "category" in the xml

I´m new to Porpoise and Layer and so i hope that anyone could help me with this issue

 thx Obimaster

James Morley

unread,
Jul 16, 2012, 3:39:17 AM7/16/12
to porp...@googlegroups.com
Hi

I'm not quite sure what it is you're trying to do here - can you give some more details and maybe an example of the data?

I've used PHP to pull xml from the Flickr API and then store it in a standard Porpoise MySql database. I then just cron this to update the data each night. See http://www.whatsthatpicture.com/2011/12/mapping-flickr-commons

Is this the sort of thing you're thinking about?

James

obimaster

unread,
Jul 16, 2012, 3:47:29 AM7/16/12
to porp...@googlegroups.com
Okay, i have this xml: http://193.171.127.158:8080/S4ASOSFacade/SosFacadeServlet?request=gets4adata

and for every Station i want to make a POI

In Porpoise on the POI-table page i have added a button "Create POIs from Stations" --> by clicking this button i want to read the xml and add the pois

James Morley

unread,
Jul 16, 2012, 6:00:21 AM7/16/12
to porp...@googlegroups.com
Read your xml into and array, then set up a foreach loop which creates all the variables from your data and finally writes a line out to your the POI table in your Porpoise db. 

For me that last bit is achieved with

mysql_query("INSERT INTO POI (
imageURL ,
linkURL ,
layerID ,
anchor_geolocation_lat ,
anchor_geolocation_lon ,
text_description ,
text_footnote ,
text_title
)
VALUES (
'$photo[url_m]', '$linkURL', '1', '$photo[latitude]' , '$photo[longitude]' , '$displaytime' , '$photo[ownername]' , '$shorttitle'
)") or die(mysql_error());

obimaster

unread,
Jul 16, 2012, 6:03:50 AM7/16/12
to porp...@googlegroups.com
thanks, that should do the job ^^

obimaster

unread,
Jul 16, 2012, 7:58:27 AM7/16/12
to porp...@googlegroups.com
but what if i want to write the array to an xml layer (i would prefer using XMLPoiconnector to SQLPoiconnector)

James Morley

unread,
Jul 16, 2012, 8:19:32 AM7/16/12
to porp...@googlegroups.com
Oh, should be even simpler to output this. Or XSLT? To be honest though I've not used the  XMLPoiconnector
Reply all
Reply to author
Forward
0 new messages