## Drawing a distance circle on map

Community Trekker

Joined:

Feb 2, 2017

Dear All,

It's my first post here, I hope someone can help.

I'm plotting several port cities on a map as part of an simple application I'm building.

Next step I want to take is to draw circles on the map indicating a user-defined distance from the city defined by a value in the data-table which is modified via scripting. Simple example: plot the location of port of Rotterdam on a map, and draw a 10 nm circle around this location on the map.

Do you have any suggestions how to program this in JSL (if necessary) and plot this?

Regards,

Bart

1 ACCEPTED SOLUTION

Accepted Solutions

Staff

Joined:

Nov 21, 2014

Solution

As chance would have it, I've done this... The attached script should give you some clues as to how to approach the problem.  change the centX and centY variables to the coordinates of your location.  You can find these using google maps, right-clicking on the location and selecting "what is here?".

7 REPLIES

Staff

Joined:

Jun 23, 2011

I don't know if this solution will eventually involve a script, but even if it will, I recommend performing the action interactively first, if possible. I also recommend using JMP objects as much as possible instead of 'starting from scratch.' I suggest that you use Graph Builder. It has a role (drop zone) for shapes or maps. Your data will include the latitude and longitude for each city. They will go into the Y and X roles, respectively. The Graph Builder also has a role for size. You can experiment with different values in this column for each city to obtain the correct diameter.

You can save the script for this finished Graph Builder to re-use it or to start your own script.

Learn it once, use it forever!

Staff

Joined:

Nov 21, 2014

Solution

As chance would have it, I've done this... The attached script should give you some clues as to how to approach the problem.  change the centX and centY variables to the coordinates of your location.  You can find these using google maps, right-clicking on the location and selecting "what is here?".

Community Trekker

Joined:

Feb 2, 2017

Thank you both; I ended up using the 2nd solution. I did a brief cross-check to sort out the conversion of miles to degrees based on a known distance between two locations and the results match.

Regards,

Bart

Community Trekker

Joined:

Feb 2, 2017

I have a brief additional question that I would like to ask.

The radius of the circles is user-defined and may change while using the
script. What would be straightforward way of updating the circles radius
interactively?

I have already experience with updating individual graphical elements
via references, but little experience with updating ranges of graphical
elements. Would I need to store this information (the reference to the
relevant circles?) in a list or matrix?

Regards,

Bart

Super User

Joined:

Jun 22, 2012

The method for doing this would be to  "Remove Graphics Script" and then to reapply "Add Graphics Script" with the new coordinates

Jim

Community Trekker

Joined:

Feb 2, 2017

Dear Craige, Nelson,

Thank you for your suggestions, the removal of graphicsscript approach
worked well, and I'm now able to adjust the range circles interactively,
based on a user-defined variable.

Regards,

Bart