pcmiler

package module
v0.0.0-...-f8d76fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2017 License: GPL-3.0 Imports: 7 Imported by: 3

README

PCMiler client for Go

This is an UNOFFICIAL client for PCMiler REST web services, currently supported version 1.0

Features

Location
  • Geocoding
  • Geocoding Batch
  • Reverse Geocoding
  • Reverse Geocoding Batch
Reports
  • Calc Miles
  • Mileage
  • Directions
  • Comparison
  • Detailed
  • Road
  • Geotunnel
  • State
  • Toll Detail
  • Hours of Service
  • Post Route Reports
  • Post Derived Route Reports
Route Services
  • Derived Route
  • Route Path
  • Route Matrix
  • Drive Time Polygon
  • Post Route Path
  • Post Derived Route
  • Post Route Matrix
Time Window Routing
  • Time Window Routing
Map Images
  • Map Tile
  • Single Map
  • Map Route
  • Overlay Tile
Weather Events
  • Weather
  • Weather Alerts
Road Surface
  • Road Surface Tile Overlay
  • Road Surface For Route
Polygon
  • County
  • State
States
  • States
  • POI Radius Search
POIs Along The Route
  • POIs Along The Route
Geofences
  • Get Geofence Set
  • Get Geofence
  • Add Geofence Set
  • Update Geofence Set
  • Delete Geofence Set
  • Add Geofence
  • Update Geofence
  • Delete Geofence
  • Route Intersection
  • Point Intersection

Contacts

Kamion LLC

Documentation

Index

Constants

View Source
const (
	ClientVersion = "0.1.3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	StreetAddress       string `json:"StreetAddress"`
	City                string `json:"City"`
	State               string `json:"State"`
	Zip                 string `json:"Zip"`
	County              string `json:"County"`
	Country             string `json:"Country"`
	SPLC                string `json:"SPLC"`
	CountryPostalFilter int    `json:"CountryPostalFilter"`
	AbbreviationFormat  int    `json:"AbbreviationFormat"`
}

func (Address) String

func (a Address) String() string

type Client

type Client struct {
	APIKey string
}

func New

func New(key string) *Client

New instantiates new PCMiler client with your API key and optional dataset, defaults to Current

func (*Client) Geocode

func (c *Client) Geocode(request GeocodeRequest) ([]GeocodeResponse, error)

func (*Client) MapRoute

func (c *Client) MapRoute(request MapRouteRequest) ([]byte, error)

func (*Client) RoutePath

func (c *Client) RoutePath(request RouteRequest) (RouteResponse, error)

func (*Client) SingleMap

func (c *Client) SingleMap(request SingleMapRequest) ([]byte, error)

SingleMap generates a map based on the request and returns the an image as the byte array

type Coordinates

type Coordinates struct {
	Lat string `json:"Lat"`
	Lon string `json:"Lon"`
}

type Cost

type Cost struct {
	CostOfStop   float64 `json:"CostOfStop"`
	HoursPerStop float64 `json:"HoursPerStop"`
	Loaded       bool    `json:"Loaded"`
	OnDuty       bool    `json:"OnDuty"`
	UseOrigin    bool    `json:"UseOrigin"`
}

type Error

type Error struct {
	Type            string `json:"string"`
	Code            int    `json:"code"`
	LegacyErrorCode int    `json:"LegacyErrorCode,omitempty"`
	Description     string `json:"description"`
}

type FuelOptions

type FuelOptions struct {
	UserID   string  `json:"UserId"`
	Password string  `json:"Password"`
	Account  string  `json:"Account"`
	FuelCap  float64 `json:"FuelCap"`
	Level    float64 `json:"Level"`
	MPG      float64 `json:"MPG"`
}

type GeocodeRequest

type GeocodeRequest struct {
	// Geocoding
	Street           string `url:"street,omitempty"`
	City             string `url:"city,omitempty"`
	State            string `url:"state,omitempty"`
	Postcode         string `url:"postcode,omitempty"`
	SearchString     string `url:"searchString,omitempty"`
	PostcodeFilter   string `url:"postcodeFilter,omitempty"`
	CitySearchFilter string `url:"citySearchFilter,omitempty"`
	Splc             string `url:"splc,omitempty"`
	List             int    `url:"list,omitempty"`

	// Reverse geocoding
	Coords                  Coordinates `url:"-"`
	MatchNamedRoadsOnly     bool        `url:"matchNamedRoadsOnly,omitempty"`
	MaxCleanupMiles         float64     `url:"maxCleanupMiles,omitempty"`
	IncludePostedSpeedLimit bool        `url:"includePostedSpeedLimit,omitempty"`
	Heading                 float32     `url:"heading,omitempty"`
	IncludeLinkInfo         bool        `url:"includeLinkInfo,omitempty"`
	Timestamp               string      `url:"timestamp,omitempty"`

	Region  string `url:"region,omitempty"`
	Dataset string `url:"dataset,omitempty"`
}

type GeocodeResponse

type GeocodeResponse struct {
	Address          Address        `json:"Address"`
	Coords           Coordinates    `json:"Coords"`
	Region           int            `json:"Region"`
	Label            string         `json:"Label"`
	PlaceName        string         `json:"PlaceName"`
	Errors           []Error        `json:"Errors"`
	ConfidenceLevel  string         `json:"ConfidenceLevel"`
	DistanceFromRoad float64        `json:"DistanceFromRoad"`
	SpeedLimitInfo   SpeedLimitInfo `json:"SpeedLimitInfo"`
}

type Geometry

type Geometry struct {
	Type        string        `json:"type"`
	Coordinates [][][]float64 `json:"coordinates"`
}

type GeometryDrawerItem

type GeometryDrawerItem struct {
	Color []RGB `json:"Color"`
}

type Legend

type Legend struct {
	DrawOnMap bool `json:"DrawOnMap"`
	Type      int  `json:"Type"`
}

type LineOptions

type LineOptions struct {
	RouteLineOptions RouteLineOptions `json:"RouteLineOptions"`
}

type Map

type Map struct {
	Viewport       Viewport             `json:"Viewport"`
	Projection     int                  `json:"Projection"`
	Style          int                  `json:"Style"`
	ImageOption    int                  `json:"ImageOption"`
	Width          int                  `json:"Width"`
	Height         int                  `json:"Height"`
	Drawers        []int                `json:"Drawers"`
	LegendDrawer   []Legend             `json:"LegendDrawer"`
	GeometryDrawer []GeometryDrawerItem `json:"GeometryDrawer"`
	PinDrawer      PinDrawer            `json:"PinDrawer"`
}

type MapRouteRequest

type MapRouteRequest struct {
	Map     Map     `json:"Map"`
	Routes  []Route `json:"Routes"`
	Dataset string  `json:"-"`
}

type Options

type Options struct {
	AFSetIDs           string       `json:"AFSetIDs"`
	BordersOpen        bool         `json:"BordersOpen"`
	ClassOverrides     int          `json:"ClassOverrides"`
	DistanceUnits      int          `json:"DistanceUnits"`
	ElevLimit          int          `json:"ElevLimit,omitempty"`
	FerryDiscourage    bool         `json:"FerryDiscourage"`
	FuelRoute          bool         `json:"FuelRoute"`
	HazMatType         int          `json:"HazMatType"`
	HighwayOnly        bool         `json:"HighwayOnly"`
	HubRouting         bool         `json:"HubRouting"`
	OverrideRestrict   bool         `json:"OverrideRestrict"`
	RouteOptimization  int          `json:"RouteOptimization"`
	RoutingType        int          `json:"RoutingType"`
	TollDiscourage     bool         `json:"TollDiscourage"`
	TruckConfig        *TruckConfig `json:"TruckCfg,omitempty"`
	UseAvoidsAndFavors bool         `json:"UseAvoidsAndFavors"`
	VehicleType        int          `json:"VehicleType"`
}

type Pin

type Pin struct {
	Category int         `json:"Category"`
	ID       int         `json:"ID"`
	Image    string      `json:"Image"`
	Label    string      `json:"Label"`
	Point    Coordinates `json:"Point"`
}

type PinDrawer

type PinDrawer struct {
	DrawOnMap          bool  `json:"DrawOnMap"`
	Pins               []Pin `json:"Pins"`
	PointGroupDensity  int   `json:"PointGroupDensity"`
	PointSpreadInGroup int   `json:"PointSpreadInGroup"`
}

type Point

type Point struct {
	X int `json:"X"`
	Y int `json:"Y"`
}

type RGB

type RGB struct {
	Red   int `json:"Red"`
	Blue  int `json:"Blue"`
	Green int `json:"Green"`
}

type Route

type Route struct {
	RouteID         string          `json:"RouteId"`
	Stops           []StopLocation  `json:"Stops"`
	Options         *Options        `json:"Options"`
	FuelOptions     *FuelOptions    `json:"FuelOptions"`
	DrawLeastCost   bool            `json:"DrawLeastCost"`
	RouteLegOptions RouteLegOptions `json:"RouteLegOptions"`
	StopLabelDrawer int             `json:"StopLabelDrawer"`
}

type RouteLabelOptions

type RouteLabelOptions struct {
	Color    RGB `json:"Color"`
	FontSize int `json:"FontSize"`
}

type RouteLegOptions

type RouteLegOptions struct {
	LineOptions LineOptions `json:"LineOptions"`
	TextOptions TextOptions `json:"TextOptions"`
}

type RouteLineOptions

type RouteLineOptions struct {
	Color RGB `json:"Color"`
	Width int `json:"Width"`
}

type RouteRequest

type RouteRequest struct {
	Stops            []Coordinates `url:"-"`
	AvoidTolls       bool          `url:"avoidTolls,omitempty"`
	HubRouting       bool          `url:"hubRouting,omitempty"`
	VehHeight        string        `url:"vehHeight,omitempty"`
	VehLength        string        `url:"vehLength,omitempty"`
	StopsAsViaPoints bool          `url:"stopsAsViaPoints,omitempty"`
	AvoidFavors      bool          `url:"avoidFavors,omitempty"`
	AfSetIDs         string        `url:"afSetIDs,omitempty"`
	VehWeight        string        `url:"vehWeight,omitempty"`
	RouteOpt         string        `url:"routeOpt,omitempty"`
	RouteType        string        `url:"routeType,omitempty"`
	VehType          string        `url:"vehType,omitempty"`
	OverrideClass    string        `url:"overrideClass,omitempty"`
	Axles            int           `url:"axles,omitempty"`
	VehDimUnits      string        `url:"vehDimUnits,omitempty"`
	OpenBorders      bool          `url:"openBorders,omitempty"`
	LCV              bool          `url:"LCV,omitempty"`
	HighwayOnly      bool          `url:"hwyOnly,omitempty"`
	DistUnits        string        `url:"distUnits,omitempty"`
	OverrideRestrict bool          `url:"overrideRestrict,omitempty"`
	HazMat           string        `url:"hazMat,omitempty"`
	VehWidth         string        `url:"vehWidth,omitempty"`
	Region           string        `url:"region,omitempty"`
	Dataset          string        `url:"dataset,omitempty"`
}

func (*RouteRequest) AddStop

func (r *RouteRequest) AddStop(stop Coordinates)

type RouteResponse

type RouteResponse struct {
	Type       string      `json:"type"`
	Geometry   Geometry    `json:"geometry"`
	TMinutes   int         `json:"TMinutes"`
	TDistance  float64     `json:"TDistance"`
	Properties interface{} `json:"properties"`
}

type SingleMapRequest

type SingleMapRequest struct {
	Point1  Coordinates `url:"-"`
	Point2  Coordinates `url:"-"`
	Style   string      `url:"style,omitempty"`
	Width   int         `url:"width,omitempty"`
	Height  int         `url:"height,omitempty"`
	SRS     string      `url:"srs,omitempty"`
	Region  string      `url:"region,omitempty"`
	Dataset string      `json:"dataset,omitempty"`
	Imgsrc  string      `json:"imgsrc,omitempty"`
}

type SpeedLimitInfo

type SpeedLimitInfo struct {
	Speed     int    `json:"Speed"`
	SpeedType string `json:"SpeedType"`
	LinkIds   int    `json:"LinkIds"`
	RoadClass string `json:"RoadClass"`
}

type StopLocation

type StopLocation struct {
	Address    Address     `json:"Address"`
	Coords     Coordinates `json:"Coords"`
	Region     int         `json:"Region"`
	Label      string      `json:"Label"`
	PlaceName  string      `json:"PlaceName"`
	Costs      []Cost      `json:"Costs"`
	IsViaPoint bool        `json:"IsViaPoint"`
}

type TextOptions

type TextOptions struct {
	RouteLabelOptions RouteLabelOptions `json:"RouteLabelOptions"`
}

type TruckConfig

type TruckConfig struct {
	Axles  int  `json:"Axles"`
	Height int  `json:"Height"`
	LCV    bool `json:"LCV"`
	Length int  `json:"Length"`
	Units  int  `json:"Units"`
	Weight int  `json:"Weight"`
	Width  int  `json:"Width"`
}

type Viewport

type Viewport struct {
	Center       *Coordinates `json:"Center"`
	ScreenCenter *Point       `json:"ScreenCenter"`
	ZoomRadius   float64      `json:"ZoomRadius"`
	CornerA      *Coordinates `json:"CornerA"`
	CornerB      *Coordinates `json:"CornerB"`
	Region       int          `json:"Region"`
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL