Retrieve shapefile from ESRI ArcServer (proxy.ashx) - dojo

Alberta has an ESRI map about the Oil Sands (OSIP): Link.
When you save the webpage you will get an proxy.ashx file which seems to contain the whole geometry:
dojo.io.script.jsonp_dojoIoScript9._jsonpCallback({"displayFieldName":"Operator_Name","fieldAliases":{"OBJECTID":"OBJECTID","OSP_NO":"Project
Number","Project_Name":"Project Name","OS_Area":"Oil Sands
Area","Industry_Type":"Industry Type","Project_Status":"Project
Status","Year":"Year","Shape.STArea()":"Shape.STArea()","Shape.STLength()":"Shape.STLength()","Operator_Name":"Operator
Name"},"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":102100,"latestWkid":3857},"fields":[{"name":"OBJECTID","type":"esriFieldTypeOID","alias":"OBJECTID"},{"name":"OSP_NO","type":"esriFieldTypeSmallInteger","alias":"Project
Number"},{"name":"Project_Name","type":"esriFieldTypeString","alias":"Project
Name","length":255},{"name":"OS_Area","type":"esriFieldTypeString","alias":"Oil
Sands
Area","length":5},{"name":"Industry_Type","type":"esriFieldTypeString","alias":"Industry
Type","length":3},{"name":"Project_Status","type":"esriFieldTypeString","alias":"Project
Status","length":3},{"name":"Year","type":"esriFieldTypeSmallInteger","alias":"Year"},{"name":"Shape.STArea()","type":"esriFieldTypeDouble","alias":"Shape.STArea()"},{"name":"Shape.STLength()","type":"esriFieldTypeDouble","alias":"Shape.STLength()"},{"name":"Operator_Name","type":"esriFieldTypeString","alias":"Operator
Name","length":75}],"features":[{"attributes":{"OBJECTID":1,"OSP_NO":1,"Project_Name":"Cold
Lake
Operations","OS_Area":"CL","Industry_Type":"02","Project_Status":"01","Year":2015,"Shape.STArea()":688184465.74006724,"Shape.STLength()":193203.94833874877,"Operator_Name":"Imperial
Oil
Resources"},"geometry":{"rings":[[[-12282289.675502496,7273922.0817552721],[-12282396.117050292,7273922.0677068951],
...CONTENT...
]]]}}]});
(Full paste available here)
Is there any way to export this as a shapefile?
PS: Would be great, if the proxy file could be used to circumvent ESRIs strategy to hide the geometry in SVG paths.

You may use AGStoShapefile from TannerGeo for this task.

I think this Link could solve your Problem to convert GeoJson to Shape.
https://community.esri.com/thread/105193
It matches your Question perfectly.
Regards, Miriam

Related

How to write WIC XMP people tags to jpg?

I have images with people tagging information in xml format. I wish to edit this information and also add it to pictures that do not yet have it. By looking at the xml I assume it is based on the people tagging used in the microsoft imaging component.
I haven't quite understood the format, but I understood it sof far, that I can alter or gemerate the xml, I just do not know where to write it in the image. I am probably just doing some stupid mistake, because I am not experienced with these image metadatas. So if you think I'm just on the wrong track and that can be done much simpler, please tell me.
In those images that already contain this xml, I can use search and replace to update the xml. However I have a lot of pictures that do not yet contain that information and I do not know where I should write it to inside the image.
Images that already contain this information can be read with exiftool as follows:
exiftool -xmp -b existingTags.JPG
The result is the following xml:
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP
Core 4.4.0-Exiv2"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:MP="http://ns.microsoft.com/photo/1.2/" xmlns:MPRI="http://ns.microsoft.com/photo/1.2/t/RegionInfo#"
xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#" xmp:Rating="0"> <dc:subject> <rdf:Bag> <rdf:li>Valeriya
</rdf:li> </rdf:Bag> </dc:subject> <MP:RegionInfo rdf:parseType="Resource"> <MPRI:Regions> <rdf:Bag> <rdf:li
MPReg:Rectangle="0.48, 0.418, 0.059333, 0.089" MPReg:PersonDisplayName="findus_l"/> </rdf:Bag> </MPRI:Regions>
</MP:RegionInfo> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="w"?>
However I cannot write the information using exiftool. When I ran this command, it simply reads the information again, instead of writing the contents of the file to the image:
exiftool -xmp<=alteredXMP.txt existingTags.JPG
A bit of research has shown me, that exiftool can only write specific xmp tags, and the people tagging tags from windows imaging component do not seem to be part of this.
Where in the image file should I write the information? Can I somehow find this spot programmatically and then just insert the xml there?
I am using Kotlin as programming language but I don't mind having to call command line functions or other programs.
Background: I have a Synology Diskstation and use the included software called photo station. The photo station supports tagging of people on the images and uses this given format. I like the photo station in many ways, but the face recognition is bad, so I want to use my own but have photo station be able to read it.
The data you are trying to write is part of the Microsoft Region Structure. XMP Structured data is a complex subject but you should be able to add the data with exiftool by writing region names to the RegionPersonDisplayName tag and the region dimensions to the RegionRectangle. Using the data in your example, the command would be:
exiftool -RegionPersonDisplayName=findus_l -RegionRectangle="0.48, 0.418, 0.059333, 0.089" /path/to/files
If you have to write multiple regions, you can just add them on, but you must keep names and the matching dimensions in the same order. For example
exiftool -RegionPersonDisplayName=findus_l -RegionRectangle="0.48, 0.418, 0.059333, 0.089" -RegionPersonDisplayName="John Smith" -RegionRectangle="0.37645533, 0.04499886, 0.35111009, 0.26633097" /path/to/files
These commands would overwrite any existing region data. If you are adding new names without overwriting, you would change the equal signs to PlusEqual +=.

JDownloader2: Formatting links for Linkgrabber

Is there any way of formatting a list of links in a text file, so JDownloader's Linkgrabber knows the package name I want?
For example:
{{packagename1}}http://link-a
{{packagename1}}http://link-b
{{packagename2}}http://link-c
{{packagename3}}http://link-d
{{packagename4}}http://link-e
{{packagename4}}http://link-f
Will put link-a and link-b in "packagename1", link-c in "packagename2", link-d in "packagename3", and link-e and link-f in "packagename4".
Someone in Reddit pointed me to the solution.
If we look in Settings / Packagizer, there's a rule editor.
A custom rule can be made that takes links in the format:
http://link-a#packagename=packagename1
Which puts the downloads found in the link in a package named "packagename1".
(Original image by the user that provided the answer, grooters)

How to store data from Google Ngram API?

I need to store the data presented in the graphs on the Google Ngram website. For example, I want to store the occurences of "it's" as a percentage from 1800-2008, as presented in the following link: https://books.google.com/ngrams/graph?content=it%27s&year_start=1800&year_end=2008&corpus=0&smoothing=3&share=&direct_url=t1%3B%2Cit%27s%3B%2Cc0.
The data I want is the data you're able to scroll over on the graph. How can I extract this for about 140 different terms (e.g. "it's", "they're", "she's", etc.)?
econpy wrote a nice little module in Python that you can use through a command-line interface.
For your "it's" example, you would need to type this command in a terminal / windows console:
python getngrams.py it's -startYear=1800 -endYear=2008 -corpus=eng_2009 -smoothing=3
This will automatically save the query result in a CSV file named after your query parameters.
econpy's package, in #HugoMailhot's answer, no longer works (2021) and seems not maintained.
Here's a updated version, with some improvements for easier integration into Python code:
https://gitlab.com/cpbl/google-ngrams
You can call this from the command line (as in econpy's) to create a CSV file, e.g.
getngrams.py it's -startYear=1800 -endYear=2008 -corpus=eng_2009 -smoothing=3
or call it from python to get (and plot) data directly in python, e.g.:
from getngrams import ngrams
df = ngrams('bells and whistles -startYear=1900 -endYear=2018 -smoothing=2')
df.plot()
The xkcd functionality is still there too.
(Issues / bug fix pull requests /etc welcome there)

Export faces from Picasa

Is there any way to export croped detected faces images from normal
images in Picasa?
Is there any way to export similar person not naming them(like
person1 and person2 etc. and maybe with probabilities)?
Is there any way to detect only one person per folder?
Once you have labeled each face within Picasa, there will be a file called .picasa.ini in the same folder as the photos. Its contents look like this:
[Contacts2]
a5719c14e1f43ecd=Bob;;
3df0fc0982a61960=Tom;;
[188698.jpg]
faces=rect64(4787040aa5044c1d),a5719c14e1f43ecd
backuphash=47212
[188766.jpg]
faces=rect64(49243a1b62da69d0),a5719c14e1f43ecd
backuphash=47212
[188804.jpg]
faces=rect64(283512ee998ed795),3df0fc0982a61960
backuphash=36479
[188803.jpg]
faces=rect64(778799bdf0c8f784),3df0fc0982a61960
backuphash=36479
[188812.jpg]
faces=rect64(28350000ae21dc8b),3df0fc0982a61960
backuphash=36479
[188806.jpg]
faces=rect64(44643314e5f5afd9),3df0fc0982a61960
backuphash=36479
You can use this data to calculate the coordinates of each rectangle you want to crop.
For more details on the .picasa.ini format, see this question:
Automatic face detection using Picasa API to extract individual images

Google maps api,Postgis,Multipolygon

PostGis WKT format of Multipolygon is:
MULTIPOLYGON(
((20.229 39.409,20.2241 39.401,20.220 39.410,20.229 39.409)),
((20.209 39.407,20.223 39.400,20.211 39.402,20.209 39.4076))
)
Google Maps api v3 Polygon is:
var triangleCoords = [
new google.maps.LatLng(25.774252, -80.190262),
new google.maps.LatLng(18.466465, -66.118292),
new google.maps.LatLng(32.321384, -64.75737)
];
The question is:
Can i create a multipolygon in google maps?
PostGIS supports a number of output formats directly:
http://postgis.refractions.net/documentation/manual-1.5/ch08.html
See the ST_As() funcs.
The Google Maps API supports a number of these as well (SVG, KML, etc.). You should try using a format that both speak. Now I'm not sure if Google Maps accepts multipolygons in any of these formats. But you could always use the ST_Simplify() func.
var multipolygon=[
[new google.maps.LatLng(x1,y1),new google.maps.LatLng(x2,y2),new google.maps.LatLng(x3,y3)],
.
.
.
[new google.maps.LatLng(x4,y4),new google.maps.LatLng(x5,y5),new google.maps.LatLng(x6,y6)]
];
This is a little old, but I was just working on the same thing, trying to create MultiPolygons from GeoJSON files in Google Maps, so thought I would share.
Basically, no, you can't. But you can create a workaround.
First create something to manage the individual sub-polygons (object, array, etc). Then populate that object with each portion of the multipolygon. Then you can treat the sub-polygons as a group, via custom methods or iteration through them.
See http://www.alecbennett.com/projects/loadgeojson for a quick demo of "MultiPolygon" highlighting on hover in Google Maps v3. Data is loaded from a GeoJSON file, so would be a similar approach to the WKT version.