Package: datacraft-geo
datacraft-geoCustom plugin fordatacraftto extend the geo types to includegeo.mgrsandgeo.utmUsage in Specsgeo.mgrs{"mgrs":{"type":"geo.mgrs"}}$datacraft-sgeo.mgrs.json-i4-r1--formatjson-x-lerror{"mgrs":"33TVE8831137089"}{"mgrs":"28CET4236233893"}{"mgrs":"33RXH7235656683"}{"mgrs":"44XNJ6899271743"}geo.utm{"utm":{"type":"geo.utm"}}$datacraft-sgeo.utm.json-i3-r1--formatjson-x-lwarning{"utm":"37 T 482637 5257154"}{"utm":"38 T 489869 4504951"}{"utm":"33 K 673513 7460351"}{"utm":"20 Q 629432 1992725"}Customizing UTM outputWe use the utm package under the hood, which provides it's output as a tuple of
(EASTING, NORTHING, ZONE_NUMBER, ZONE_LETTER) e.g: (513864.9288961077, 1664402.2459186069, 25, "P").
The default is to format this as:{{ zone_number }} {{ zone_letter }} {{ easting | int }} {{ northing | int }}You can override this by specifying
atemplateconfig parameter with the fields arranged as you like.  See example below. The other way is to override
thegeo_utm_templatedefault value from the command line
(datacraft --set-defaults geo_utm_template="{{ zone_number }}{{ zone_letter }} {{ easting | int }}/{{ northing | int } }"). Note that{{ zn }}can be used in place of zone_number and{{ zl }}in place of zone_letter.{"utm_custom":{"type":"geo.utm","config":{"template":"{{ zn }}{{ zl }} {{ easting | int }}/{{ northing | int }}"}}}$datacraft-sgeo.utm.custom.json-i3-r1--formatjson-x-lwarning{"utm_custom":"37T 325263/5115949"}{"utm_custom":"31N 676324/553043"}{"utm_custom":"45J 300889/6854467"}{"utm_custom":"44R 288307/2890462"}Geo Lat/Long/Pair ClippedThese types are extensions to the existing datacraft geo types to support clipping of the points using
geojson to specify valid polygon boundaries.Typesnamedescriptiongeo.pair.clipcoordinate pair as list with longitude first, unless lat_first=True specifiedgeo.lat.cliplatitude from a coordinate pair bounded by the geojsongeo.long.cliplongitude from a coordinate pair bounded by the geojsongeo.utmalso supports clippinggeo.mgrsalso supports clippingExample:fromshapely.geometryimportshapegeojson={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[23.0843,53.1544],[23.0859,53.1544],[23.0859,53.1535],[23.0843,53.1544]]]}}shape(geojson['geometry'])The image above describes the boundary of where we want our points to exist. To reference this geojson boundary, we
can use thegeojsonconfig parameter in two ways.as the raw geojson{"coords":{"type":"geo.pair.clip","config":{"geojson":{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[23.0843,53.1544],[23.0845,53.1544],[23.0859,53.1535],[23.0843,53.1544]]]}},"join_with":","}}}as the file name path to the geojson file{"coords":{"type":"geo.pair.clip","config":{"geojson":"/path/to/clip.geo.json","join_with":","}}}Instead of hard-coding the path, you can specify just the file name then use the--data-dirto specify where to look
for it and other data related files.Multiple PolygonsYou can use multiple polygons as boundaries by using a GeoJSON FeatureCollection:{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[23.0843,53.1544],[23.0845,53.1544],[23.0859,53.1535],[23.0843,53.1544]]]}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[33.0843,43.1544],[33.0845,43.1544],[33.0859,43.1535],[33.0843,43.1544]]]}}]}