T-F-S / mercatormap

A LaTeX package for spherical Mercator coordinate systems and Web Mercator tile integration.
LaTeX Project Public License v1.3c
3 stars 2 forks source link

Distance parameter for "\mrcmarker" #2

Closed rolfn closed 4 years ago

rolfn commented 4 years ago

I created a map similar to the example in the manual:

    ...
    {
      \mrcmarker{named position=\city,type=knob,fill=red!20,draw=red,
        radius=2mm}
      \mrcmarker{named position=\city,type=pin,fill=blue!10,draw=blue,
        contents=\name}
    }
   ...

The result would look better if I could reduce the distance between the pin marker and the city position. How can it work? The following picture shows the problem. xxx Many thanks in advance.

T-F-S commented 4 years ago

For the type pin, there is no distance customization (yet).

But you can create your own marker type as documented. One way is to copy and modify some package code. In the following example, a new marker xpin is made from pin with an distance modifier \mydistance. If \mydistance is set to 0.5, you have the original pin distance.

\def\mydistance{0.25}

\ExplSyntaxOn

\__mermap_new_marker_type:nn {xpin}
  {
    \path[fill=mrcmarkerfill,draw=none,fill~opacity=0.7]
      (0,0) -- (0.1,\mydistance) -- (-0.1,\mydistance) -- cycle;
    \node[fill=white,draw=none,text=mrcmarkertext,
      above,font=\mrcmarkerfont,inner~sep=0.5mm,align=center,
      line~width=0mm,xshift=\mrcmarkershift,
      fill~opacity=0.7,text~opacity=1,xshift=0mm,mrcnodestyle]
      (pin_node) at (0,\mydistance) {\mrcmarkercontents};
    \path[draw=mrcmarkerdraw,fill=none,line~join=round,mrcpathstyle]
      (0,0) -- (0.1,\mydistance) -- (pin_node.south~east) -- (pin_node.north~east)
      -- (pin_node.north~west) -- (pin_node.south~west)
      -- (-0.1,\mydistance) [line~join=bevel] --  cycle;
  }

\ExplSyntaxOff
rolfn commented 4 years ago

Thanks a lot. This helps.

T-F-S commented 4 years ago

I incorporated this distance feature to pin into Version 1.02 (2020-08-06).

rolfn commented 4 years ago

Many Thanks.