More

Bounding Box in CuRL Tool(REST API)

Bounding Box in CuRL Tool(REST API)


I have set my time interval using CuRL tool for automatic Geowebcache… How to set bounding box in curl command?


It is documented in GeoWebCache manual http://www.geowebcache.org/docs/current/rest/seed.html

Here is an example about REST seed request in json format. I hope it helps. Note the non-standard gridset.

curl -v -k -u admin:geoserver -XPOST -H "Content-type: application/json" -d "{'seedRequest':{'name':'GWC_layer','bounds':{'coords':{ 'double':['3200000.0','7000000.0','3300000.0','7100000.0']}},'srs':{'number':2393},'zoomStart':8,'zoomStop':11,'format':'image/png','type':'seed','threadCount':4}}}" "http://localhost:8080/geoserver/gwc/rest/seed/GWC_layer.json"

How to call a REST Web API for access token with these cURL commands - in C#

I'm a little bit new to OAuth, but learning. What I have is this tutorial I'm trying to follow. I'm trying to follow the simple 3-line example under "Bio - retrieving biographical record data": https://members.orcid.org/api/tutorial-retrieve-data-public-api-curl-12-and-earlier

What I need to do though, is use a C# console program to do this instead of CURL, I imagine using the HttpClient namespace. I have my own client id and client secret to use. I'm trying to use this public API to get an access token to store wherever, then make calls to get XML data like this example does. My problem is that I don't know how to convert their CURL calls to C# code. I'm NOT using an ASP.NET website for this. this all needs to be done in a C# console program.


GeoBoundingBoxType

A GeoBoundingBoxType defines a rectangular area in a geographic coordinate system. This type is derived from the abstract base type GeoAreaType.

As the bounding box is specified by its top-left and bottom-right corner of the box, it is not necessarily the smallest rectangle spanned by these two points it is possible to define bounding boxes that are wider than 180° or higher than 90° (for example, by setting the longitude of top-left corner to a bigger value than the longitude of the bottom-right corner).

A bounding box with longitude of -180° for the top-left corner and a longitude of 180° for the bottom-right corner constructs an area that encircles the globe whereas a bounding box with the same longitude values for both corners constructs a bounding box of width 0°.

The GeoBoundingBoxType has the following attributes:

Top-left corner of the rectangular area.

WGS-84 / degrees with (-90 <= Latitude <=90)

WGS-84 / degrees with (-180 <= Longitude <=180)

Altitude in meters (optional)

Bottom-right corner of the rectangular area.

WGS-84 / degrees with (-90 <= Latitude <=90)

WGS-84 / degrees with (-180 <= Longitude <=180)

Altitude in meters (optional)


Bounding Box in CuRL Tool(REST API) - Geographic Information Systems

Back in the 1980's, David Harrison of UC-Berkeley wrote a wonderful implementation of a kd-tree geographic search algorithm, as part of the OctTree project, which was a tool to design Integrated Circuits. Here, transistor structures needed to be placed edge to edge to form wires and logical circuits. OctTools provided tools to automatically generate some circuit parts, and also provided an editor to allow users to manually view and manipulate the drawings. To do all this efficiently, they needed a quick 2-d bounding-box search mechanism. This is the package that provided it.

While the rest of the world seems to have fallen in love with quad trees, and other mechanisms, I was inspired by kd-trees, and my tests using this code showed that kd-trees are efficient, can handle large datasets, and are pretty resilient.

A recent search of the web for kdtree implementations turned up nothing but point searches in 1-d space. For practical purposes, forgive the pun, but this is pointless. This implementation is for generic 2-d objects, which could include circles, ellipses, lines, etc, which will all have a bounding box to describe their minimum and maximum x and y boundaries. The tree uses the bottom, top, left, and right sides of bounding boxes so that each side is used to split the data at each level in the tree, in a cyclical fashion, as you descend the tree to the leaves.

I wrote this code back in 1990, and only discovered it again recently. I decided to make it available to the world, as I really haven't found any good public geographic databases available.

Back in 1990, I also wrote a 3D kdtree implementation, but that code got lost. Sorry. Really, it's not that hard to take this code and turn it into a 3D database. I spotted a 3D implementation at http://g3d.sourceforge.net/ (G3D Innovation Engine) -- I haven't evaluated it yet, but based on all the surrounding goodies, it looks very promising!

Also, this code assumes that bounding boxes are 32-bit integers. It would not be difficult to turn that into longs or long longs and get 64-bit resolution.

Here are the list of my changes to his code:

    • my build used the nodes son's links to form lists, rather than the list package.
    • my build uses the geometric mean criteria for finding central nodes, rather than
    • Added nearest neighbor search routine. TODO: allow the user to pass in pointer
    • Added rebuild routine. Faster than a build from scratch.
    • Added node deletion routine. For those purists who hate dead nodes in the tree.
    • Added some routines to give stats on tree health, info about tree, etc.
    • I may even have inserted some comments to explain some tricky stuff happening
    • the original code was written in ancient k&r style it wasn't even compiling
    • upgraded kd_test.c to use 1 million random boxes seems more appropriate

    Not all of it is working yet. But, eventually, I'll grab a moment here and there to finish it off.

    The really_delete routine seems to have problems with the last delete.

    The code was part of the OctTools system, and uses other packages, like the error stuff (uprintf), and this stuff needs to be cleaned out to reduce the complexity and allow other users to determine what to do on errors.

    kd_test needs to be upgraded to test every function. Especially the "Nearest Neighbor" stuff.

    Valgrind comes up with all sorts of illegal reads and some illegal writes. All are quite mysterious. Need to clean all this up.

    It would probably be nice to use configure to build from source. Wouldn't it?

    Hey, don't you think that other packages, like GLIB, KDE, GNOME, window managers and systems, anything working in 2d-space, would have a good geographic search mechanism built in? Oh, yes, I forgot! There will never be more than 32 or 64 objects in use, ever, so why bother? Just use linear search!

    OctTools was licensed to allow anyone to do anything with it, as long as they kept the copyright notice.

    I added my copyright for my changes, and made MY changes available under the GNU LGPL v2 license. Life is complex, isn't it?


    Bounding Box in CuRL Tool(REST API) - Geographic Information Systems

    Tasks in AρρEEARS correspond to each request associated with your user account. Therefore, each of the calls to this service require an authentication token as described above.

    Task object

    Tasks are defined as a JSON payload with several properties that are common between area and point sample requests. One simple way to view the properties for a task JSON is to observe the output request JSON from a completed AρρEEARS request or make an API call to list the tasks for your account as described below.

    The following properties are required for all tasks.

    Property Description
    task_name The user-defined name of the task.
    task_type The type of the task, either area or point .
    params The parameters for the request, including the required dates and layers definition as well as any area or point specific parameters.
    The dates parameter consists of a date_object and the layers parameter consists of one or more layer_object .

    The date_object is defined as follows:

    The layer_object is defined as follows:

    Property Description
    product The product and version identifier for the product (e.g. MOD11A1.006 ).
    layer The name of the layer (e.g. LST_Day_1km ).

    There are additional properties that are required for area requests.

    Property Description
    geo A GeoJSON object defining the spatial region of interest.
    The projection of any coordinates must be in a geographic projection.
    output The details about how the output files should be formatted.
    The file_type must be one of geotiff or netcdf4 .
    The projection_name must be one of the supported projections (e.g. native , geographic ). The list of supported projections can be generated via an API call described here .

    There are additional properties that are required for point requests.

    id (optional) - User-defined unique string identifier for the coordinate that can be used to identify a specific coordinate.

    category (optional) - User-defined string category used to group one or more coordinates.

    latitude - Numeric geographic latitude for the coordinate.

    Parameters required for all task requests

    Parameters required for all area requests

    Parameters required for all point requests

    Task query parameters

    In addition to the JSON payload described in the Task object, data passed into the URL's query string can be used to specify properties for the task.

    If provided, query parameter properties take precedent over any JSON payload present. For instance, if the value for the task_name property in the task object is 'task1' and the query parameter for task_name with a value of 'task2' is provided, the value for task_name will be 'task2'.

    Space and other white space characters must not be present in the query parameter values.

    The parameters that are supported in the query string are listed in the tables below.


    Geography

    At various endpoints SeeClickFix recognizes geography either by a point or area attribute. If multiple points are specified, they will be evaulated in the listed order of precedence.

    NOTE: The use of the address parameter to specifiy a location is deprecated on our public endpoints. API clients must handle reverse geocoding locally and use one of the alternate parameter forms to specify a point or area. Queries using address may result in an error response.

    Points can be defined in one of two forms:

    1. lat=:latitude&lng=:longitude - The latitude and longitude of the point of interest.
    2. address=:address - (deprecated) Geocode the address and use the resulting latitude/longitude as a point.

    area attributes can be submitted in the following forms:

    1. lat=:latitude&lng=:longitude&zoom=:zoom
    2. address=:address&zoom=:zoom - (deprecated)
    3. place_url=:url_name - See the places documentation for more information.
    4. min_lat=:sw_lat&min_lng=:sw_lng&max_lat=:ne_lat&max_lng=:ne_lng - Defines the bounding box of the area of interest.
    5. watcher_token=:watcher_token - The token can be found in the URL of the watch area’s issue map, a link to this can be found on the right hand column of the watch area display page

    Easy way to remove collars from GeoTIFF of USGS Topo?

    I have downloaded a lot of GeoTiffs of historical topo maps from the USGS ( https://ngmdb.usgs.gov/topoview) a t the 1:24000 scale. I am wanting to Mosaic these together to eventually clip to watershed boundaries, however the white collars on the outside are proving to be a headache. I have not been able to find a solid answer on these forums or anywhere else on the internet of how exactly to remove the collars.

    Does anyone have an answer?

    Any help would be appreciated!

    by DanPatterson_Re tired

    I don't imagine that it is as simple as clipping the collar. That would only be useful if the tiles matched at the edge when clipped. I suspect that there is some rotation and perhaps some overlap?

    Perhaps you can provide some details as to whether there is overlap in the adjoining sheets and whether you can convert the 'collar' to nodata for use in a Con statement (details later)

    by XanderBakker

    The "n" and "g" the the beginning of the URL are switched, it should be this: https://ngmdb.usgs.gov/topoview/

    I just download 2 adjacent tiles and see what you mean there is overlap since the maps include all the legend and metadata too:

    However, you could script a solution with Python. In the xml file of the data you will see information on the boundng box of the actual data:

    Which corresponds to the map (looking at a corner):

    So you could for each TIFF read the bounding box from the xml data and apply an Extract by Rectangle—Help | ArcGIS Desktop to get the part you are interested in.

    by XanderBakker

    In additional, you would have to transform the decimal degrees from the bounding box to North_American_1927_Polyconic, since the tiles have projected coordinates. See the worldfile (tfw):

    and the coordinate files (.prj)

    Okay, so I figured out how to open the files and actually successfully executed the extract by rectangle in Python. However, the output is just blank. So im thinking the bounding box coordinates are the extent of the whole image including the white collar? Not entirely sure. How would you successfully extract just the image?

    by XanderBakker

    In order to extract the rectangle correctly you would have to specify the rectangle using the coordinates of the TIFF (the projected coordinates and not the geographic coordinates). To do this right you would have to project the decimal degrees found in the xml to the coordinate system " North_American_1927_Polyconic " (at least that is the coordinate system from the example tiles I downloaded). The challenge here might be the fact that this projected coordinate system is not a standard coordinate system recognized by ArcGIS as shown below:

    Now it seems to be aligning with the basemap if I use the first transformation offered to me:

    . and some changes through the years in the flow of the river become clear:

    If I have some time, I will see what I can come up with to process the data. This may take some time though.


    Note: Cellular devices may indicate that the device is online for up to 46 minutes after the device has gone offline because it went out of range or was powered off. Wi-Fi devices will generally be accurate to within a few minutes. Online indications are should occur immediately if the device was previously offline for both cellular and Wi-Fi.

    List Devices

    List devices the currently authenticated user has access to. By default, devices will be sorted by last_handshake_at in descending order.

    Array of devices. See Get device information for the response attributes of each device.

    List Devices in a product

    List all devices that are part of a product. Results are paginated, by default returns 25 device records per page.

    Filter results to devices with this ID (partial matching)

    Comma separated list of full group names to filter results to devices belonging to these groups only

    Filter results to devices with this name (partial matching)

    The attribute by which to sort results. Options for sorting are deviceId , firmwareVersion , or lastConnection . By default, if no sortAttr parameter is set, devices will be sorted by last connection, in descending order

    The direction of sorting. Pass asc for ascending sorting or desc for descending sorting

    include / exclude quarantined devices

    An array of devices objects. See Get device information for the response attributes of each device.

    An array of customer objects

    An activation code used for device claiming if the product is in "Private Beta" mode

    Total number of pages of device records

    Import Devices into product

    Import devices into a product. Devices must be of the same platform type as the product in order to be successfully imported. Imported devices may receive an immediate OTA firmware update to the product&aposs released firmware.

    Importing a device with a SIM card will also import the SIM card into the product.

    A device ID to import into a product. Pass id if you are trying to import a single device

    Import SIM card associated with each device into the product

    A .txt file containing a single-column list of device IDs, device serial numbers, device IMEIs or device ICCIDs. This is the preferred method of importing many devices into a product at once. Encoded in multipart/form-data format

    The number of devices successfully added to the product

    Device IDs that already belong to other products that could not be imported

    Device IDs that were invalid and could not be imported

    Get device information

    Get basic information about the given device, including the custom variables and functions it has exposed.

    IP address of the device the last time it connected to the cloud

    Date and Time that the cloud last heard from the device in ISO 8601 format

    Date and time that the device most recently connected to the cloud in ISO 8601 format

    For development devices, this equals platform_id. For product devices, your product number.

    Indicates whether the device is currently connected to the cloud

    Indicates the type of device. Example values are 6 for Photon, 10 for Electron, 11 for Argon, 12 for Boron.

    True for cellular devices (Electron, Boron), false otherwise

    Free-form notes about the device

    List of function names exposed by the device

    List of variable name and types exposed by the device

    The serial number of the device, if it exists

    When normal indicates the is running user application, when safe_mode indicates that the device has missing Device OS dependencies and is not running the user application.

    Last SIM card ID used for cellular devices

    IMEI number for cellular devices

    Version of Device OS running on the device last reported to the cloud

    Deprecated. Use system_firmware_version .

    Version of Device OS to use when compiling firmware for this device in the Web IDE. If not set, uses default_build_target .

    Version of Device OS to use when compiling firmware for the platform of this device in the Web IDE.

    Indicates whether the device will accept firmware updates without being forced

    Indicates whether firmware updates on the device have been forced from the cloud.

    The product ID that the device reported in its firmware the last time it connected to the cloud. Product devices only

    An array of group names that the device belongs to. Product devices only

    The version number the device reported in its firmware. Product devices only

    The version of firmware that the device has been individually locked to run. Product devices only

    The product firmware version the device is targeted to receive based on the locked version and released firmware. If firmware_version matches targeted_firmware_release_version , the device is currently running this firmware. Product endpoint only

    Set to true if a device has been marked as a development device, meaning it will not receive any product firmware updates from the cloud. Product endpoint only

    If set to true , the device is unrecognized and has lost product privileges until it is manually approved. Product endpoint only

    If set to true , this is a quarantined device that has been permanently denied access to product privileges. Product endpoint only

    Get product device information

    Get basic information about a given device that is part of a product

    See Get device information for the response attributes

    Get a variable value

    Request the current value of a variable exposed by the device. Variables can be read on a device you own, or for any device that is part of a product you are a team member of.

    Specify raw if you just the value returned

    Product ID or Slug. Product endpoint only.

    Call a function

    Call a function exposed by the device, with arguments passed in the request body. Functions can be called on a device you own, or for any device that is part of a product you are a team member of.

    Function argument with a maximum length of 63 characters

    Specify if you want the just the function return value returned

    Product ID or Slug. Product endpoint only.

    Indicates if the device is currently connected to the cloud

    Return value from the called function

    Ping a device

    This will ping a device, enabling you to see if your device is online or offline

    Product ID or Slug. Product endpoint only.

    Indicates if the device is currently online

    Rename a device

    Rename a device, either owned by a user or a product

    Product ID or slug. Product endpoint only

    The desired name for the device

    Timestamp representing the last time the deivce was updated in ISO8601 format

    Add device notes

    Product ID or slug. Product endpoint only

    Notes that you would like to add to the device

    Notes that have been added to the device

    Timestamp representing the last time the deivce was updated in ISO8601 format

    Create a claim code

    Generate a device claim code that allows the device to be successfully claimed to a Particle account during the setup process. You can use the product endpoint for creating a claim code to allow customers to successfully claim a product device. Use an access token that was generated by the Particle account you&aposd like to claim ownership of the device.

    When creating claim codes for Wi-Fi devices like Photons, allow the cloud to generate the claim code for you. This is done by not passing anything to the request body (with the exception of products in private beta, which require an activation code to generate a claim code). Then, this claim code must be sent to the Photon via SoftAP. For more information on how to send claim codes to Particle devices via SoftAP, please check out Particle SoftAP setup for JavaScript.

    Conversely, for cellular devices like Electrons, you must create a claim code equal to the iccid or imei of the device. This is because Electrons are not directly connected to by the client during setup. This is done by passing an iccid or imei in the body of the request when creating a claim code.

    When an device connects to the cloud, it will immediately publish its claim code (or in the case of Electrons, it will publish its ICCID and IMEI). The cloud will check this code against all valid claim codes, and if there is a match, successfully claim the device to the account used to create the claim code.

    IMEI number of the Electron you are generating a claim for. This will be used as the claim code if iccid is not specified.

    ICCID number (SIM card ID number) of the SIM you are generating a claim for. This will be used as the claim code.

    Activation Code. Only required if product is in private beta. Product endpoint only.

    Product ID or Slug. Product endpoint only.

    a claim code for use during the device setup process

    Array of device IDs that already belong to the user

    Claim a Device

    Claim a new or unclaimed device to your account.

    Request device transfer from another user

    Indicates you are requesting a device transfer from another user

    Unique ID that represents the transfer

    Provision a new device ID

    Product that allows self-provisioning

    Remove device from product

    Remove a device from a product and re-assign to a generic Particle product. This endpoint will unclaim the device if it is owned by a customer .

    ID of the device to be removed

    Unclaim device

    Remove ownership of a device. This will unclaim regardless if the device is owned by a user or a customer , in the case of a product.

    When using this endpoint to unclaim a product device, the route looks slightly different:

    Note the /owner at the end of the route.

    ID of the device to be unclaimed

    Signal a device

    Make the device conspicuous by causing its LED to flash in rainbow patterns

    1 to start shouting rainbows, 0 to stop

    Force enable OTA updates

    Force enable OTA updates on this device.

    true to force enable updates, false to unforce updates.

    Look up device identification from a serial number

    Return the device ID and SIM card ICCD (if applicable) for a device by serial number.

    The serial number printed on the barcode of the device packaging.

    The ID of the device associated with this device

    The ICCID number (SIM card ID number) of the SIM card associated with this device


    You will notice for each resulting image, the API provides an identifier:

    OneAtlas Basemap keeps an archive of all images previously used. Within this example of ten images, the first result will be the image used for the current OneAtlas Basemap, while the other nine results will be previously archived images.

    A search response body contains the following components for each feature:

    • geometry : Represents the footprint of the image. It’s a GeoJSON Polygon in WGS84 coordinates that represents the geographic area used in the basemap.
    • properties : Contains detailed metadata of the image. The most meaningful data is displayed in the table below.

    Let&rsquos look at some of the parameters in more detail:

    Field nameDescription
    idUnique identifier of the image within OneAtlas Basemap
    acquisitionDateCorresponds to he acquisition date of the image
    cloudCoverCorrespond to the average cloud coverage of an image, 0 meaning that the image is cloud free and 100 that the image is totally cloudy
    constellationName of the constellation, in the case of OneAtlas Data this value could be equal to SPOT of Pleiades
    incidenceAngleThe incidence angle is the angle from the target point of view. It represents the angle between the ground normal and look direction from the satellite, combining the pitch and roll angles.
    resolutionThis corresponds to the satellite used. 0.5 for Pleiades and 1.5 for SPOT.

    © Airbus Defence and Space 2018. All rights reserved. Privacy Policy | Legal Information


    2 Answers 2

    I am using form digest for rest calls from Powershell to SharePoint. Using scheduled tasks running as the user you need to authenticate to SharePoint.

    First do a POST to [https://. ]/_api/contextinfo with header Accept=application/jsonodata=verbose and an empty body. The response in $.d.GetContextWebInformation.FormDigestValue is the Request Digest.

    Then do your other rest calls using the following header: Accept=application/jsonodata=verbose Content-Type=application/jsonodata=verbose X-RequestDigest=[response for FormDigestValue] X-FORMS_BASED_AUTH_ACCEPTED=f

    The FormDigestValue does expire, so either check the expiration at the end of the value before every call and re-call contextinfo or re-call it every time you do a call.

    It also works from workflows, using the dictionary variable and adding Authorization in the header with an empty value.