Select to view content in your preferred language

How to load custom places from file or db

425
0
05-15-2017 02:28 AM
AndTom
by
Emerging Contributor

Hello since Google maps can load custom places from .xml file, what about Arcgis, I found that they have example, but its saved in .json format, while i retrieved their example .json and put on my local server seems it can't load, so how to load custom places using Arcgis? Example: https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=fl_featureCollection

I read that server must be enabled mime types, so I enabled these:

application/vnd.geo+json

application/geo+json

My server is XAMPP:

XAMPP Installers and Downloads for Apache Friends 

Do I need todo more, because it doesn't load

My first file saved as json:

jsonFlickrFeed(
{
"title": "Recent Uploads with geodata",
"link": "https:\/\/www.flickr.com\/photos\/",
"description": "",
"modified": "2017-05-10T17:53:36Z",
"generator": "https:\/\/www.flickr.com",
"items":
[
{
"title": "Ronda - Spain",
"link": "https:\/\/www.flickr.com\/photos\/henkverheyen\/34191951980\/",
"media": {"m":"https:\/\/farm5.staticflickr.com\/4168\/34191951980_25bd33ea18_m.jpg"},
"date_taken": "2017-04-22T21:50:10-08:00",
"description": " <p><a href=\"https:\/\/www.flickr.com\/people\/henkverheyen\/\">Henk Verheyen<\/a> posted a photo:<\/p> <p><a href=\"https:\/\/www.flickr.com\/photos\/henkverheyen\/34191951980\/\" title=\"Ronda - Spain\"><img src=\"https:\/\/farm5.staticflickr.com\/4168\/34191951980_25bd33ea18_m.jpg\" width=\"240\" height=\"160\" alt=\"Ronda - Spain\" \/><\/a><\/p> <p>20170422_Ronda_266<\/p>",
"published": "2017-05-10T18:00:45Z",
"author": "nobody@flickr.com (\"Henk Verheyen\")",
"author_id": "72671715@N05",
"tags": "andalusi\u00eb es spain spanje avond longexposure night ronda andaluc\u00eda city",
"latitude" : "36.741852",
"longitude" : "-5.166348"
}
]
})

And as XML:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:georss="http://www.georss.org/georss"
xmlns:woe="http://where.yahooapis.com/v1/schema.rng"
xmlns:flickr="urn:flickr:user"
xmlns:media="http://search.yahoo.com/mrss/">
<title>Recent Uploads with geodata</title>
<link rel="self" href="http://api.flickr.com/services/feeds/geo" />
<link rel="alternate" type="text/html" href="https://www.flickr.com/photos/"/>
<id>tag:flickr.com,2005:/photos/public/geo/</id>
<icon>https://s.yimg.com/pw/images/buddyicon.gif</icon>
<subtitle></subtitle>
<updated>2017-05-14T19:13:29Z</updated>
<generator uri="https://www.flickr.com/">Flickr</generator>
<entry>
<title>The Poke House, Fort Lauderdale, Florida</title>
<link rel="alternate" type="text/html" href="https://www.flickr.com/photos/symbiosis/34658524485/"/>
<id>tag:flickr.com,2005:/photo/34658524485</id>
<published>2017-05-14T19:13:29Z</published>
<updated>2017-05-14T19:13:29Z</updated>
<flickr:date_taken>2017-05-07T19:08:28-08:00</flickr:date_taken>
<dc:date.Taken>2017-05-07T19:08:28-08:00</dc:date.Taken>
<content type="html">&lt;p&gt;&lt;a href=&quot;https://www.flickr.com/people/symbiosis/">Symbiosis</a> posted a photo:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.flickr.com/photos/symbiosis/34658524485/" title=&quot;The Poke House, Fort Lauderdale, Florida&quot;&gt;&lt;img src=&quot;https://farm5.staticflickr.com/4162/34658524485_bbd5364046_m.jpg" width=&quot;240&quot; height=&quot;160&quot; alt=&quot;The Poke House, Fort Lauderdale, Florida&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
<author>
<name>Symbiosis</name>
<uri>https://www.flickr.com/people/symbiosis/</uri>
<flickr:nsid>75554154@N00</flickr:nsid>
<flickr:buddyicon>https://farm8.staticflickr.com/7289/buddyicons/75554154@N00.jpg?1369617261#75554154@N00</flickr:buddyicon>
</author>
<link rel="enclosure" type="image/jpeg" href="https://farm5.staticflickr.com/4162/34658524485_bbd5364046_b.jpg" />
<category term="poke" scheme="https://www.flickr.com/photos/tags/" />
<category term="thepokehouse" scheme="https://www.flickr.com/photos/tags/" />
<category term="fortlauderdale" scheme="https://www.flickr.com/photos/tags/" />
<category term="florida" scheme="https://www.flickr.com/photos/tags/" />
<category term="liguidaloha" scheme="https://www.flickr.com/photos/tags/" />
<category term="konabrewingcompany" scheme="https://www.flickr.com/photos/tags/" />
<displaycategories>
</displaycategories>
<georss:point>26.128913 -80.108759</georss:point>
<geo:lat>26.128913</geo:lat>
<geo:long>-80.108759</geo:long>
<woe:woeid>91996931</woe:woeid>
</entry>
</feed>

function requestphoto

function requestPhotos() {
//get geotagged photos from flickr
//tags=flower&tagmode=all
var requestHandle = esriRequest({
//url: "https://api.flickr.com/services/feeds/geo?&format=json",
//url: "objects.xml",

url: "objects.json",
callbackParamName: "jsoncallback"
});
requestHandle.then(requestSucceeded, requestFailed);
}

And it throws in cosole always failed, files are in same directory, what I'm missing?

0 Kudos
0 Replies