Tuesday, October 18, 2016

arcgis server rest api tile service


tilestream and others

/zoom(z)/x/y.png

 http://166.62.80.50:8887/v2/city_parcels/12/706/1641.png



arcgis server tile service:  no png, x and y in different order

/zoom(z)/y/x
http://services3.arcgis.com/VILr8UqX00eNAkeO/ArcGIS/rest/services/Parcels/MapServer/tile/12/1641/706

node js module client side browsify



How to use Esri/arcgis-to-geojson-utils in client side browser.


0) install browerify  by :    C:\Users\HU_J>npm install -g browserify

1) go to the target directory.  npm install arcgis-to-geojson-utils

  C:\Apache24\htdocs\civilgis\public\js\arcgis>npm install arcgis-to-geojson-utils

2)now you have see node_modules folder has been created.

browserify -r arcgis-to-geojson-utils > bundle.js

   
C:\Apache24\htdocs\civilgis\public\js\arcgis>browserify arcgis_to_geojson.js -o
bundle.js

C:\Apache24\htdocs\civilgis\public\js\arcgis>browserify -r arcgis-to-geojson-uti
ls > bundle.js

3) now include "bundle.js" in html tag.





4). now you could use node module in javascript such as:
        "require" your module


     arcgisToGeoJSON = require('arcgis-to-geojson-utils').arcgisToGeoJSON;
                             //var _geojson_object = arcgisToGeoJSON(data);
                             var _geojson_object = arcgisToGeoJSON(JSON.parse(data));

                              alert(JSON.stringify(_geojson_object));

arcgis online arcgis server rest api geojson

now arcgis online already support output geojson format through arcgis rest api URL. All you need to do is set f=geojson in the URL.
Be aware, by default, arcgis online will out allow geojson format until you set it allow other output format(geojson).
here is how to do that:
arcgis online, click the feature layers, click the setting tab
check this box
Export Data Allow others to export to different formats.
save and wait a few minutes,
in the query page, you should see the output format dropdownlist already have geojson option, before, it only has json/html.

===============================================================



arcgis server rest api, feature service, 

if you query the layer, with URL like this,  .../FeatureServer/query?layerDefs=...

http://services3.arcgis.com/VILr8UqX00eNAkeO/arcgis/rest/services/Parcels/FeatureServer/query?layerDefs={"0":""}&returnGeometry=true&f=pgeojson&geometryType=esriGeometryEnvelope&geometry={"xmin" : -117.923158, "ymin" : 33.644081, "xmax" : -117.921436, "ymax" : 33.645157,"spatialReference" : {"wkid" : 4326}}
  

You can not set geojson format, f=pgeojson will be bad request, f=json, because the return stuff is not feature, the layers json was return. 



Try this html query page, you can see, no geojson option, 
http://services3.arcgis.com/VILr8UqX00eNAkeO/arcgis/rest/services/Parcels/FeatureServer/query


------------------------------------------------



If you want to return geojson (feature), you must use this URL .../FeatureServer/0/query...

/0/ means layerID, if on has only 1 layer, then layerID = 0.....


Try this html query page, you can see, geojson is option, because you are query specific layer with layerID = 0

http://services3.arcgis.com/VILr8UqX00eNAkeO/arcgis/rest/services/Parcels/FeatureServer/0/query




Note: remember to set those 2 parameters: outSR=4326&f=geojson in the URL spatial reference ID, srid = 4326, because web map all use this, f means format, both f=pgeojson and f=geojson works. If you don't set outSR=4326, arcgis server rest api by default will NOT use 4326, instead use something else, only 4326 has unit degree, which is used in most web map. Other format would not work with web maps.


so the working example URL is:


  http://services3.arcgis.com/VILr8UqX00eNAkeO/arcgis/rest/services/city_online/FeatureServer/17/query?returnGeometry=true&f=pgeojson&geometryType=esriGeometryEnvelope&geometry={"xmin" : -117.923158, "ymin" : 33.644081, "xmax" : -117.921436, "ymax" : 33.645157,"spatialReference" : {"wkid" : 4326}}

  

/city_online/ is feature layer
/17/  is layerID

Thursday, October 6, 2016

right of way parcel, clip and reverse clip, polygon.

1) merge all parcels into one polygon.

     Edit parcel,
     select all polygon,
    editor drop down menu, choose merge, follow instruction



You must merge multi part polygon into one single big polygon for clip use.
Otherwise the clip function will grey out.


2) use city boundary clip the one polygon parcel

    Edit both one polygon parcel and city boundary.

   select the one polygon,

   editor drop down menu, choose clip, follow instructions.