Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cronico26
Contributor
Contributor

GeoOperations: use CLOSEST with two loaded tables

Hi, 

how can i use the extesion CLOSEST with 2 loaded tables in script?

This is the example:

MyPoints:
LOAD * inline "
id;point
1;[12,57.7]
2;[12.1,57.7]
" (delimiter is ';');

MyPoints2:
LOAD * inline "
id2;point2
1;[12,59.7]
2;[12.1,59.7]

3;....

4;........

" (delimiter is ';');

MyClosestPoints:
Load * Extension GeoOperations.ScriptEval('
Closest(distance="100000", distanceType="car")
DATASOURCE pts INTABLE keyField="id", pointField="point"
DATASOURCE pts INTABLE keyField="id2", pointField="point2"
', MyPoints, MyPoints2);

 

Thank you so much.

Cronico26

Labels (1)
9 Replies
Patric_Nordstrom
Employee
Employee

Only one intable can be used in a SSE operation.

The workaround is to use csv for the second table.

Another option is to merge the two tables together and use merged table as input and then filter the table afterwards to get the right result.

Thanks,

Patric

cronico26
Contributor
Contributor
Author

Thank you very much Patrick for your support.

Using the table above, how I can replace the script of MyPoints2 (Table2) with a CSV file?

Thank you for all your assistance


Cronico26

 

124rooski
Partner - Creator
Partner - Creator

I'm having the same issue. I was initially able to have routes between 2 points using a spreadsheet and a table from the database, but I have one point (that is 100% in the spreadsheet) not being taken into account on the front-end when loading the script. 

Patric_Nordstrom
Employee
Employee

@cronico26 

Here's an Closest example with the second table exported to csv file:

// Closest example
// Load point data

pts:
LOAD * inline "
id;point
1;[12.3,57.8]
2;[12.2,57.9]
3;[12.0,57.6]
4;[12.8,57.5]
" (delimiter is ';');

pts2:
LOAD * inline "
id2;point2
1;[12,57.7]
2;[12.1,57.7]
" (delimiter is ';');

// Store pts2 into csv file to be able to feed two tables into Closest example

store pts2 into [lib://Patrics Share:Dropbox pn/Share/temp/points.csv] (txt, delimiter is ';');

// Copy direct link from dropbox:
// https://dl.dropbox.com/s/2crzsqtnugzjjes/points.csv?dl=0

MyClosestPoints:
Load * Extension GeoOperations.ScriptEval('
Closest(distance="100000", distanceType="car")
DATASOURCE pts INTABLE keyField="id", pointField="point"
DATASOURCE pts2 CSV 
  	url="https://dl.dropbox.com/s/2crzsqtnugzjjes/points.csv?dl=0", 
    fieldSeparator="SEMICOLON",
    keyField="id2" ,
    geometryField="point2" ,
    geometryType="POINT"
', pts);

See also the attached app.

Thanks,

Patric

WIPER
Partner - Contributor
Partner - Contributor

Want to display closest distance b.w plant and dest. kindly help in this. screenshots are attached.

CHansford
Luminary
Luminary

@Patric_Nordstrom  is this still the case with the new GeoOperations Wizard as nowhere have I seen anything in the documentation that states this and even in the wizard I can choose 2 intables?

If the csv is the only option can I use a url for the in app storage like I can for shpzip files?

Regards

CHris

JCAMAIN
Employee
Employee

@CHansford  -  Did you hear back from Patric?  Otherwise, I've asked him directly although he is on hols at the moment

JCAMAIN
Employee
Employee

@CHansford - Yes, can only have one inline table - I've stored my first set of data into a separate file:

Store NewData into [lib://SpaceName:DataFiles/NewlyCreated.csv] (txt, delimiter is ';');

 

and then referenced that as the first item (I'm running within operation)

[WithinResultTable]:
Load * Extension GeoOperations.ScriptEval('
SELECT enclosed_enclosing_RelationId, FaultID, WRZ_NAME, enclosing.Geometry, enclosed.PostCode, enclosed.e2util_name, enclosed.e2sww_cestablename, enclosed.Mode of contact, enclosed.e2util_enquiryclassname, enclosed.e2sww_enquirytypename, enclosed.TimeStamp, enclosed.Date, enclosed.Day of Week, enclosed.e2lrgt_postcode, enclosed.Latitude, enclosed.Longitude, enclosed.FaultLocation FROM
Within()
DATASOURCE enclosed CSV url="lib://SpaceName:DataFiles/NewlyCreated.csv", keyField="FaultID", geometryField="FaultLocation", geometryType="point", fieldSeparator="SEMICOLON", recordSeparator="NEWLINE", crs="auto"
DATASOURCE enclosing INTABLE keyField="WRZ_NAME", crs="auto", polygonField="Geometry"
', Shapefiles);

CHansford
Luminary
Luminary

@JCAMAIN I hadn't had anything back from Patric on this topic or another one about Travel Areas, however in the meantime I have solved both issues myself.

Thanks for the above, when I have time I will see if this is what I did or whether it was solved in a different way.