Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

--simplify-proportion is a little bit trial and error in finding the perfect number.

Lastly we need to change the name of the 

Adding the topojson to an application

Add the file to the webapp/data/maps folder.

Now we can add the map to the application. Add the UiTopoMapFactory to the component Class and UiExtenstion.Builder() for the Class.

Code Block
languagejava
linenumberstrue
protected final UiTopoMapFactory topoMapFactory =
        () -> ImmutableList.of(
                new UiTopoMap("south_america", "South America", "*south_america", 0.9)
        );

protected UiExtension extension = 
	new UiExtension.Builder(CL, coreViews)
        .messageHandlerFactory(messageHandlerFactory)
        .topoOverlayFactory(topoOverlayFactory)
        .topoMapFactory(topoMapFactory)
        .resourcePath(CORE)
        .build();

UiTopoMap(String id, String description, String path, Double scale);

Id: is the string found within the topojson file.

Code Block
{
	"type": "Topology",
	"objects": {
		"south_america": {} //This is the Id
	}
} 

Description: The name to appear in the maps drop down menu
Path: The path to the topojson resource ('*' is a place holder for ~/data/maps) 
Scale: Sets the map scale