Monday, 17 June 2019

Create UNIX timestamp for ArcGIS Server Feature REST API

When you feed or update datetime column in ArcGIS REST API the current date and time has to be in UNIX epoch milliseconds.

In Python this is the easiest way to do:

int(time.time())*1000
The *1000 is required to get the milliseconds from the seconds. Obviously this way is only accurate to the second...if you want to gain more precision you should perhasp go with this:
float(time.time())*1000
With this methodology you will not loose the milliseconds due to integer rounding.

Friday, 14 June 2019

Cannot convert a value of type \'java.lang.String\' to \'TIMESTAMP\'

The ArcGIS REST API just needs an epoch time bigint - so convert it to numbers.

To check the values this site works:
https://currentmillis.com/



How to prepare JSON payload for ArcGIS Feature Service using Python

There you have it - this is just a dump from my code - purely to remind myself...

What it does it creates a point array then using Python it puts this payload to an ArcGIS Feature Service.


ptemp = {}
... print type(ptemp)
... ptemp["attributes"]={}
... ptemp["attributes"]["objectid"]=1
... ptemp["attributes"]["s"]=223
... ptemp["attributes"]["a"]="a val"
... ptemp["attributes"]["n"]="n val"
... ptemp["attributes"]["b"]=123
... ptemp["attributes"]["p"]="p val"
... ptemp["attributes"]["g1"]=11
... ptemp["attributes"]["g2"]=22
... ptemp["attributes"]["g3"]=33
... ptemp["attributes"]["g4"]=44
... ptemp["attributes"]["g5"]=55
... ptemp["geometry"]={}
... ptemp["geometry"]["x"]=152.95359856272353
... ptemp["geometry"]["y"]=-23.461733290059232
... ptemp["geometry"]["spatialReference"]={"wkid" : 4326}

So we created the ptemp dictionary object with point parameters.

>>> url = config["serviceurl"]+"/0/addFeatures?token={}&f=pjson"
... token = getToken("uname", "password")
... url = url.format(token)

Now we acquired the token and added to url.

>>> pptemp = []
>>> pptemp.append(ptemp)

Now we just put the dictionary to a list - this needed for the ArcGIS Feature Service.

pt = urllib.quote_plus(json.dumps(pptemp))

Now we created an encoded payload from json string.
st='features='+pt
st=st+'&gdbVersion=&rollbackOnFailure=true&f=pjson'
...and finally we send all of these to the ArcGIS Feature Service in a POST request:

>>> request.add_header("Content-Type",'application/x-www-form-urlencoded')
>>> request = urllib2.Request(url, data=st)
>>> connection = opener.open(request)
>>> connection.readlines()

Monday, 3 June 2019

Goliath Search Engine Resources

Here we list all resources we have found in relation with Goliath Search Engine. Entries and indexes were found all around the web. These indexes are listed below:

Search Engine with a Difference - Goliath Search

I have been stumbled across with a new Search Engine called Goliath Search. It seems a standard web search engine at first but using it a few times made me realize that search results are really different than using Google and Bing - I would say the provided search results are more aligned with the search term and really didn't brought up any spam-like websites either.

What I really liked that this search engine also provides you with a PDF search facility. This means that all of returned search results are actually PDF documents rather web pages. This is a very unique feature, which no other search engine provides - unless the user puts special codes in to the search term.

All in all - Goliath Search is a rather unique search engine and I shall recommend all my readers to give it a try...its free :)

Read more about this search engine...access some additional features of this search engine here...