cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
shasheminassab
Level IV

Can JMP show custom Mapbox as background map?

I created a custom map on Mapbox and used its URL in the Web Map Service of Graph Builder but nothing showed up. Can JMP actually show custom Mapbox as background map?

7 REPLIES 7
gzmorgan0
Super User (Alumni)

Re: Can JMP show custom Mapbox as background map?

@shasheminassab ,

 

There is not enough information in your post to be able to anwer your question.  I found no JMP object called a MapBox, there is

  • a MapSeg that is for a Background Map that can be added to a graph's FrameBox, 
  • a MapShape that can be added via  the GraphBuilder controls.

I am thinking you are refering to the Map Shape area in the GraphBuilder as the Map Box.  The script below was copied from the JMP Help >Scripting Guide> Clip Shape  The script creates a density contour map and uses the US States a s a background map

 

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Cities.jmp" );
gb = Graph Builder(
	Size( 653, 396 ),
	Show Control Panel( 0 ),
	Variables( X( :Longitude ), Y( :Latitude ) ),
	Elements( Contour( X, Y, Legend( 2 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Background Map( Boundaries( "US States" ) ), Grid Line Order( 2 ),
			Reference Line Order( 3 )}
		)
	)
);
cs = (gb << Report)[FrameBox( 1 )] << Find Seg( Contour Seg( 1 ) );
Wait( 2 );
cs << Clip Shape( Boundaries( "US States" ) );

image.png

 

This next script uses the same data table and a Map Shape

Graph Builder(
	Size( 551, 618 ),
	Show Control Panel( 0 ),
	Variables( Overlay( :State ), Color( :POP ), Shape( :State ) ),
	Elements( Map Shapes( Legend( 7 ), Show Missing Shapes( 1 ) ) )
)

 

image.png

 

The first graph maps some function relative to Longitude and Latitude with the map shape in the background. The second graph hase sub areas defined and maps some value (like population or ozone level) for each sub area (state). Each state is a discrete shape.

 

 

Saving the script for your graph and posting it, will help the JMP community answer your question. 

shasheminassab
Level IV

Re: Can JMP show custom Mapbox as background map?

Thanks @gzmorgan0 . I was referring to mapbox.com where you can make custom maps. I know there is an option in the background map dialog where you can add maps from Web Mapping Service (WMS). When I use  a custom map URL that I created on mapbox.com in the WMS section of background map nothing shows up.

Craige_Hales
Super User

Re: Can JMP show custom Mapbox as background map?

I don't see anything about mapbox having a wms server. JMP has one that supplies the open street map data.

https://en.wikipedia.org/wiki/Web_Map_Service is an overview.

You might be able to get a high res image and use it as a background picture, but you may have issues with map projections and alignment of pixels to the graph coordinates.

@XanGregg 

 

Craige
shasheminassab
Level IV

Re: Can JMP show custom Mapbox as background map?

Thanks @Craige_Hales . I have been using custom Mapbox maps in Tableau which significantly enhances the mapping experience. That's why I was wondering it can be imported to JMP as well or not. Thanks for the clarification though.

gzmorgan0
Super User (Alumni)

Re: Can JMP show custom Mapbox as background map?

@shasheminassab,

 

The problem could be that your syntax for accessing the map is incorrect. If you did not want to publish on this forum you could send your script or screen shot to @Craige_Hales in a private email.  If a solution is found, please post any learning to the forum. 

jimloughlin
Level III

Re: Can JMP show custom Mapbox as background map?

The  density contour map doesn't line up correctly on the map when I run it.   Perhaps because of the error I got on the first chunk of code:   

 

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Cities.jmp" );
gb = Graph Builder(
    Size( 653, 396 ),
    Show Control Panel( 0 ),
    Variables( X( :Longitude ), Y( :Latitude ) ),
    Elements( Contour( X, Y, Legend( 2 ) ) ),
    SendToReport(
        Dispatch(
            {},
            "Graph Builder",
            FrameBox,
            {Background Map( Boundaries( "US States" ) ), Grid Line Order( 2 ), Reference Line Order( 3 )}
        )
    )
);
cs = (gb << Report)[FrameBox( 1 )] << Find Seg( Contour Seg( 1 ) );
Wait( 2 );
cs << Clip Shape( Boundaries( "US States" ) );


/*:

The display box 'ContourSeg' does not recognize the message 'Clip Shape'; perhaps you mean one of these: <<Class Name <<Sib Append <<Sib Prepend <<Line Style <<Line Style,Set Line Style.

 

On the second chunk of code I believe you need a semi-colon on the last statement.

Jim Loughlin
Loughlin Consulting
gzmorgan0
Super User (Alumni)

Re: Can JMP show custom Mapbox as background map?

@jimloughlin,

 

Regarding Clip Shape, it was implemented in JMP version 14. I am on Windows 10 OS. I have tested and successfully run this on versions 14.3 and 15.1. It does not wrk on JMP 13 since it was implemented for JMP 14, I do not recall if it was a dot version or the initial release of JMP 14.

 

Regarding the second block of code:

  • JSL syntax, the semicolon is Glue. 
  • Since that block of code was the last statement in my script, it does not require a semicolon to run.