Dev: SM: Vector File Renderer

From AAT Wiki
Jump to: navigation, search

Overview

The Image Daemon is a service that delivers images and json from uploaded SHP and KML files. The service name ImageDaemon and listens on the default port of 5505. Data is stored in the user_features table.

Uploading

You can Upload your SHP / KML file in zip format here https://www.streetmaps.co.za/api/FeaturesForm.asp. If you are upload SHP files, the ZIP should include all other files EG: .dbf, .prj, .sbn .. etc

Image Rendering

http://....userfeatures.asp?Styles={id:all;lw:5;lc:ff0000}&action=image&x=?&y=?&w=?&h=?&s=?&id=?

x = longitude

y = latitude

s = degree scale

w = pixel width of required image

h = pixel height of required image

id = After uploading you File you will be given a ID to be placed here.

Styles = set the color of the Route and thickness

     Id = all for everything, else it is the name of the source file in the zip. Eg stage1 (no extension)
     Lc = color in google kml format.
     Lw = line width
     For multiple styles ={id:route1;lw:5;lc:ff0000},{id:route2;lw:5;lc:ff0000}


optional:

imgtype = jpg, default is png

Overlay on maps

Add the following two Lines to the Maps load function (Basic_Map)

        featurelayer = myMap.AddLayer("custom", 4);
        featurelayer.SetCustomUrl(https://www.streetmaps.co.za/userfeatures.asp?styles={id:all;lw:5:;lc:F0A014}&action=image&x=%x%&y=%y%&s=%scale%&w=%width%&h=%height%&id={1C9BCBC8-B2B4-488D-B7E2-C1ABBCB8755F}");

JSON

http://....:userfeatures.asp?action=js&x=?&y=?&w=?&h=?&s=?&id=?exclude=?&json=?

json=java function to execute on return. It can include a ( for eg json=processJS(myvar,'a const, and it will just add the json and closing );

The json param is optional, so call can be xmlrequest

exclude=1 to make it only return points within the x,y,w,h,s limits, otherwise it returns all points for id. Line and Polygon structures are ignored.

id=comma delimited list of uf_ref values

Returns the following json structure:

{data : 
[
{id:?, points : [elementid:?, name:?, description:?, x:?, y:?],...},
{id:?, points : [elementid:?, name:?, description:?, x:?, y:?],...},
...
]}

Click Test

http://....userfeatures.asp?action=click&x=?&y=?id=?exclude=?&json=?

x,y = the long/lat to test.

All polygons in the id list are checked and the first that contains x,y is returned.

Returns the following json structure:

{id:?, elementid:?, name:?, description:?}

Element Info

http://....userfeatures.asp?action=info&?id=?&elementid=?&json=?

Returns the following json structure:

{id:?, elementid:?, name:?, description:?}