Help:Handling lines with Maps or SemanticMaps

From semantic-mediawiki.org
Semantic extension(s): Semantic Maps
Further extension(s): Maps
Keyword(s): maps · routes · lines · coordinates

Description:

Problem[edit]

I encountered a problem while I was trying to display lines on a SemanticMaps (eg: with multiple points like 59.9699756,5.7331073:60.3912628,5.3220544:60.3872241,6.343943).

SemanticMaps doesn't support this feature yet/anymore. (cf Issue on GitHub)

Solution[edit]

Requirements[edit]

How to[edit]

Create a Template:Route

This uses the Semantic Internal Objects extension {{#set_internal}}

<includeonly>{{#set_internal:Route
|Name={{{1}}}
|Data={{{2}}}
|Mapdata={{{2}}}~{{{1}}}~ ~#156BB4
}}</includeonly><noinclude>
All the routes are Blue like #156BB4
== Usage ==
<pre>
{{Route|Rouen-Paris|49.440482,1.093772:47,2}}
</pre>
== Rendering ==

{{Route|Rouen-Paris|49.440482,1.093772:47,2}}

</noinclude>
Insert your route in a page

In the page you want a route, you insert this : (Rouen and Paris are 2 cities in France)

{{Route|Rouen-Paris|49.440482,1.093772:47,2}}
Create your map

Where you want your map, insert a simple map from the Maps extensions (not Semantic Maps)

{{#display_map: <!-- here you can add points if you want -->
|mainlabel=-
|lines=
{{#ask:  [[Route::+]] |?Mapdata= |mainlabel=- |format=list |sep=; |limit=200}}
|center=Paris
|zoom=3
|height=700
|service=leaflet
}}

And you're good to go !

Extra tips for free[edit]

Create a detailed route with precise points[edit]

To find out the detailed coordinates of your Route, I suggest you use the OSRM - Open Source Routing Machine.

Once you created your track, you can export it as a GPX file.

Simplify your tracks[edit]

With your full GPX track, you can use the GPX Simplify Optimizer which is a great tool to visualize, simplify or export your GPX file in different formats.

It will allow you to simplify the GPX tracks so there is less points, and export it in Mediawiki format like A,B:C,D:E,F etc... It works perfectly in Semantics Mediawiki with hundreds of points. (I didn't test it with more yet)

Hope this can help.