<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yi Xu on Medium]]></title>
        <description><![CDATA[Stories by Yi Xu on Medium]]></description>
        <link>https://medium.com/@yixu0215?source=rss-1886a88a9943------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*F8w0GFD_fLiznHOAtXQB_w.jpeg</url>
            <title>Stories by Yi Xu on Medium</title>
            <link>https://medium.com/@yixu0215?source=rss-1886a88a9943------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 21:16:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yixu0215/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tell a Story by Map]]></title>
            <link>https://medium.com/@yixu0215/tell-a-story-by-map-64e4d2db61e?source=rss-1886a88a9943------2</link>
            <guid isPermaLink="false">https://medium.com/p/64e4d2db61e</guid>
            <category><![CDATA[world-cup]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[mapbox]]></category>
            <dc:creator><![CDATA[Yi Xu]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 05:47:46 GMT</pubDate>
            <atom:updated>2018-07-23T19:55:30.983Z</atom:updated>
            <content:encoded><![CDATA[<p>As mapping technologies become more and more powerful, maps are not only used for navigation or simply telling you how the world looks like. We can use maps to create cool data visualizations to power the business intelligence. Now, we can even use maps to tell stories.</p><p>During Russia World Cup 2018, <a href="https://www.mapbox.com/">Mapbox</a> initiated a campaign called World Map Cup. In round 3, I learned how to create an interactive story map. I created a story map for Iceland because it was their first time to enter the World Cup Finals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*grqHa84n3gdCMZf3" /><figcaption><a href="https://roxyi.github.io/world_cup_story_map/">Check out the live version</a></figcaption></figure><h3><strong>How I built it</strong></h3><h4><strong>Choose a style</strong></h4><p>First, we need an Iceland style basemap. I used <a href="https://www.mapbox.com/cartogram/#13.01/40.7251/-74.0051">Cartogram</a>, a drag-and-drop tool to create a custom map in seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cky0i_X5zIkuDNTT" /><figcaption>Use an image of the Iceland team to create a basemap</figcaption></figure><h4><strong>Get the starter code</strong></h4><p><a href="https://twitter.com/geografa">Rafa</a> shared a <a href="https://blog.mapbox.com/world-map-cup-round-3-38e7edff89a6">tutorial</a> about how to create an interactive story map. He shared a piece of <a href="https://gist.github.com/geografa/a16ffa888f692f68a80f9bdd53f6b845#file-index-html">starter code</a> to help us quickly start to work on the project.</p><h4><strong>Add a 3D choropleth map</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DOo0FTdQJPla0H7IqSb3bw.png" /><figcaption>3D choropleth map</figcaption></figure><p>On <a href="https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)">Wikipedia</a>, there is a list of countries by population. I manually created a geojson and added the population of all Russia World Cup qualifiers. To create a choropleth map, in the map layer’s paint property, we can set several stops for different colors. I recommend this <a href="http://www.zonums.com/online/color_ramp/">tool</a> to create the color ramp.</p><pre>&#39;fill-extrusion-color&#39;: {<br>    property: &#39;population&#39;,<br>    type: &#39;interval&#39;,<br>    stops: [<br>        [337780, &#39;#ffffd9&#39;],<br>        [5754356, &#39;#edf8b1&#39;],<br>        [11364372, &#39;#c7e9b4&#39;],<br>        [32885991, &#39;#7fcdbb&#39;],<br>        [46017766, &#39;#41b6c4&#39;],<br>        [66573504, &#39;#1d91c0&#39;],<br>        [127185332, &#39;#225ea8&#39;],<br>        [143964709, &#39;#253494&#39;],<br>        [143964709, &#39;#081d58&#39;]<br>    ]<br>}</pre><p>Then choose a property as the height of the map layer. I divided the population by 50 so that the 3D polygons will not be too high.</p><pre>&#39;fill-extrusion-height&#39;: [&#39;/&#39;, [&#39;get&#39;, &#39;population&#39;], 50],<br>&#39;fill-extrusion-base&#39;: 0</pre><h4><strong>Add a chart</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*S1wWXq-p_Dnh_33EVuOhwQ.png" /><figcaption>Created with Highcharts</figcaption></figure><p>I used a library called <a href="https://www.highcharts.com/">Hightcharts</a>. It is well documented and has plenty of demos. Sometimes, when comparing data, charts are better than maps. But when you want to compare the data spatially, a map is definitely better.</p><h4><strong>Create hover effects</strong></h4><p>In the chapter 2 and 4, I added hover effects to the map layers. I implemented Mapbox’s new expressions and feature-state feature. You can learn how to use Mapbox GLJS expressions <a href="https://www.mapbox.com/help/mapbox-gl-js-expressions/">here</a>. The feature-state has not been documented yet but you can find a pretty good example <a href="https://www.mapbox.com/mapbox-gl-js/example/hover-styles/">here</a>.</p><p>When creating the map layer, you need to specify the style when the layer is hovered. Use Mapbox GL JS expressions to do the job.</p><pre>map.addLayer({<br>    id: &#39;players&#39;,<br>    type: &#39;circle&#39;,<br>    source: &#39;playerData&#39;,<br>    paint: {<br>        &#39;circle-color&#39;: &#39;#fff&#39;,<br>        &#39;circle-stroke-width&#39;: 1,<br>        &#39;circle-stroke-color&#39;: &#39;#000&#39;,<br>        &#39;circle-radius&#39;: [&#39;case&#39;,<br>            [&#39;boolean&#39;, [&#39;feature-state&#39;, &#39;hover&#39;], false],<br>            15,<br>            12<br>        ]<br>    }<br>});</pre><p>Next, write the hovering function. The key of the hovering function is the hover id. When you create the geojson data source for the map layer, remember to specify a unique id (must be numeric) for every object. With the unique id, map.setFeatureState() can change the feature state of an individual map object instead of the whole layer.</p><pre>var hoverId = null;</pre><pre>// When the user moves their mouse over the players layer, we&#39;ll <br>// update the feature state for the feature under the mouse.<br>map.on(&#39;mouseenter&#39;, &#39;players&#39;, function(e) {<br>    if (e.features.length) {<br>        map.getCanvas().style.cursor = &#39;pointer&#39;;<br>        if (hoverId) {<br>            map.setFeatureState({source: &#39;playerData&#39;, id: hoverId}, { hover: false});<br>        }<br>        hoverId = e.features[0].id;<br>        map.setFeatureState({source: &#39;playerData&#39;, id: hoverId}, { hover: true});<br>    }<br>});</pre><pre>// Reset layer&#39;s feature state when the mouse leaves the layer.<br>map.on(&#39;mouseleave&#39;, &#39;players&#39;, function() {<br>    map.getCanvas().style.cursor = &#39;&#39;;<br>    if (hoverId) {<br>        map.setFeatureState({source: &#39;playerData&#39;, id: hoverId}, { hover: false});<br>    }<br>    hoverId =  null;<br>});</pre><h4>Animated the marker</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*XWW9aW9u_ejioLJJaqrynw.gif" /><figcaption>marker animation</figcaption></figure><p>Learned from <a href="https://www.mapbox.com/about/team/rasagy-sharma/">Rasagy Sharma</a>’s <a href="https://blog.mapbox.com/advanced-guide-customize-controls-more-a543e27c5fd1">blog</a>, I was able to create my own animated markers. The key to creating the animation is window.setInterval() function. It will execute the function periodically. In the window.setInterval() function, we need to periodically change the marker’s paint properties (in my case, they are size and opacity).</p><pre>window.setInterval(function(){<br>    //If the circle is expanded, reduce the size and opacity<br>    //If the circle is not expanded, increase the size and opacity<br>    var size = (expanded)? 10 : 20;<br>    var opacity = (expanded)? 0 : 0.25;</pre><pre>    //Change the radius and opacity of the circles<br>    if (map.getLayer(&#39;stadium-halo&#39;)) {<br>        map.setPaintProperty(&#39;stadium-halo&#39;, &#39;circle-radius&#39;, size);<br>        map.setPaintProperty(&#39;stadium-halo&#39;, &#39;circle-opacity&#39;, opacity);<br>    }</pre><pre>    //Toggle the value of expanded<br>    expanded = !expanded;<br>},500);</pre><h3>Summary</h3><p>These are pretty much the key features of my story map. Thank Mapbox for sharing these amazing mapping technologies. Basically all of the skills I used to create this map are learned from Mapbox’s blogs, documentation, and examples. Also, in this project, I feel like I was working as a filmmaker. It was really fun to prepare the story, look for data and manipulate the map camera.</p><p>You can play the interactive map <a href="https://roxyi.github.io/world_cup_story_map/">here</a>. Check out the full <a href="https://github.com/Roxyi/world_cup_story_map">source code</a>, and hit me up on <a href="https://twitter.com/yixu16">Twitter</a> if you have any questions!</p><p>Happy Mapping y’all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64e4d2db61e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic Label Placement with Mapbox GL JS + Turf + PolyLabel]]></title>
            <link>https://medium.com/@yixu0215/dynamic-label-placement-with-mapbox-gl-js-turf-polylabel-1f84f1d4bf6b?source=rss-1886a88a9943------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f84f1d4bf6b</guid>
            <category><![CDATA[turf]]></category>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[gis]]></category>
            <dc:creator><![CDATA[Yi Xu]]></dc:creator>
            <pubDate>Fri, 06 Apr 2018 04:24:50 GMT</pubDate>
            <atom:updated>2018-04-06T04:40:51.377Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.mapbox.com/mapbox-studio/">Mapbox Studio</a> has an amazing feature. When you upload polygon features to the Mapbox Studio, you change the data type to line, circle, and even symbol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*k_ui7LGQbNb_Xa_jXJrFmA.png" /><figcaption>You can select “symbol” even if your data source is polygon</figcaption></figure><p>This feature can facilitate the label placement for polygon features. You don’t need to turn your polygon features to point features and use the converted point features to place labels.</p><p>However, there is a problem about it. It is duplicate labels.</p><p>For example, I uploaded the data for all neighborhoods in New York City to Mapbox Studio and changed the type to “symbol”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TacpBSDlW2KlzSz_0LyI0Q.png" /><figcaption>NYC neighborhoods</figcaption></figure><p>Zoom into Greenpoint. You can see there are duplicate labels in the same neighborhood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7RykSKT32L8rzuc8ehnAmw.png" /><figcaption>duplicate lables</figcaption></figure><p>How does that happen? It is a result of <a href="https://en.wikipedia.org/wiki/Tiled_web_map">tile boundaries</a>.</p><p>Let’s turn on the tile boundaries in the debug mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*8VpFgWbWPXS1YFDD2dK8nA.png" /><figcaption>The red lines are tile boundaries</figcaption></figure><p>You can see that the polygon of Greenpoint is divided to 5 parts by the tile boundaries. In each tile, Mapbox Studio finds the centroid of a part of Greenpoint and places the label. The advantage of this method is that you can always see the labels however you move the map, as long as the polygon is within the map view. This is dynamic label placement. It is quite useful because it always tells you where you are. You don’t lose any information when you move the map.</p><p>The dynamic labels are cool but too many duplicate labels are annoying. How do we fix that? We can use <a href="https://www.mapbox.com/mapbox-gl-js/api/">Mapbox GL JS</a>, <a href="http://turfjs.org/">Turf.js</a> and an opensource JS library called <a href="https://github.com/mapbox/polylabel">polylabel</a> from Mapbox to create our own dynamic labeling application.</p><p><strong>Step 1: Get the polygons sliced by tile boundaries</strong></p><p>Before creating dynamic labels, you need to know what is within the map view. Use <a href="https://www.mapbox.com/mapbox-gl-js/api#map#queryrenderedfeatures">map.queryRenderedFeatures</a> to get the features in the map view.</p><pre>map.queryRenderedFeatures({<br>    layers: [polygon-layer]<br>});</pre><p>The returned results of that function are polygons. But they are not polygons within the map view. Let’s draw these polygons to see why.</p><p>You can see in the image below that the returned results are actually polygons in the tiles within the map view not technically the polygons within the map view. This is because Mapbox GL JS renders data based on tiles. You can imagine tiles as books and data as the content in books. When you query rendered data from the map view, Mapbox GL JS will pick the books that are in the map view for you. You need to figure out which contents are out of the map view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vkgVZIhdfxA2qQPCenLGHA.png" /><figcaption>Red line: tile boundaries, Green line: map view boundary, Blue line: results of map.queryRenderedFeatures</figcaption></figure><p>We can use <a href="http://turfjs.org/docs#intersect">Turf.intersect</a> to do get the polygons in the map view.</p><pre>var intersection = turf.intersect(mapViewBound, polygon);</pre><p><strong>Step 2: Choose a visual center for each sliced polygon</strong></p><p>The intersection you got from Turf.intersect is a polygon feature. The next step is getting a visual center of the polygon. I recommend using polylabel.js. For information about this library, check <a href="https://blog.mapbox.com/a-new-algorithm-for-finding-a-visual-center-of-a-polygon-7c77e6492fbc">this amazing article</a> out. You can also use <a href="http://turfjs.org/docs#centroid">Turf.centroid</a> or <a href="http://turfjs.org/docs#centerOfMass">Turf.centerOfMass</a>.</p><p>After completing this step, you get the result pretty similar to the one you get from Mapbox Studio which is a bunch of duplicate labels. You need one more step to get the best result.</p><p><strong>Step 3: Get a center of visual centers</strong></p><p>You may get several visual centers from the last step because of, as is demonstrated, tile boundaries. You can use <a href="http://turfjs.org/docs#center">Turf.center</a> to do the job. You can also try other algorithms to get a better result. The goal of this step is removing duplicates. Another alternative is using <a href="http://turfjs.org/docs#area">Turf.area</a> to keep the label which is in the largest polygon. To do this, unlike Turf.center, the label you get will always in the polygon.</p><p><strong>Step 4: Use event listener to monitor the movement of the map</strong></p><p>This will make your map truly dynamic. Mapbox GL JS provides you with a bunch of event listeners. The one we are going to use is <a href="https://www.mapbox.com/mapbox-gl-js/api#map.event:moveend">moveend</a>.</p><pre>map.on(&#39;moveend&#39;, function() {<br>    your dynamic labeling function<br>});</pre><p>Your dynamic labeling function will be invoked just after the map completes a transition from one view to another (including pan and zoom).</p><p><strong>Final product:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*_IsyMbFBPQUJpkbcfjR4fA.gif" /></figure><h3>Demo:</h3><p>You will need to move the map to see the effect. I also add a fixed label layer to make the result look better.</p><p><a href="https://roxyi.github.io/dynamic_labels/">Dynamic Neighborhood Label</a></p><p>The source code of this project is here:</p><p><a href="https://github.com/Roxyi/dynamic_labels">Roxyi/dynamic_labels</a></p><h3><strong>Happy Mapping!</strong></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f84f1d4bf6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use PGRestAPI and Mapbox to map a large dataset]]></title>
            <link>https://medium.com/@yixu0215/use-pgrestapi-and-mapbox-to-map-a-large-data-set-40c41f94f5ec?source=rss-1886a88a9943------2</link>
            <guid isPermaLink="false">https://medium.com/p/40c41f94f5ec</guid>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[spatial-server]]></category>
            <category><![CDATA[pgrestapi]]></category>
            <category><![CDATA[mapping]]></category>
            <dc:creator><![CDATA[Yi Xu]]></dc:creator>
            <pubDate>Sun, 08 Oct 2017 20:39:59 GMT</pubDate>
            <atom:updated>2017-10-08T20:46:59.744Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*Gs9T0fNa9VxDoQs8p3JnnQ.png" /><figcaption>Mapbox + PGRestAPI (a.k.a Chubbs Spatial Server)</figcaption></figure><p>Online mapping platforms/services like <a href="https://www.mapbox.com/">Mapbox</a>, <a href="https://carto.com/">Carto</a>, and <a href="https://developers.google.com/maps/">Google Map API</a> facilitate web-based mapping. I used them a lot in my map projects and also recommended them to my friends.</p><p>Recently, a friend of mine struggled with mapping a large dataset. He tried to upload his dataset to Mapbox Studio but the size of the dataset was so large that it exceeded the transfer limits. He asked me for help and I suggested him convert his data to MBTiles and host it on a spatial server. I wrote my solution down in this article in case someone else meet the similar problem.</p><h3>Problem:</h3><p>When the size of your dataset exceeds the transfer limits of online mapping platforms/services but you still want to use their mapping API, what should you do?</p><h3><strong>Solution:</strong></h3><p>Host your data on a spatial server where you can request data in formats like GeoJSON or MBTiles that can be used for web-based mapping. I recommend using <a href="https://github.com/spatialdev/PGRestAPI">PGRestAPI</a> and <a href="https://www.mapbox.com/">Mapbox</a>.</p><p><strong>Step 1: Get the right data format<br></strong>First, you need to find the data formats supported by the JS library that you are using.</p><p>For example, if you are using Mapbox GL JS or decide to use it, MBTiles is probably the best format. Although you can upload different types of data to Mapbox Studio, the platform will automatically convert your data to MBTiles. In Mapbox GL JS, you will find it easy to create map layers with MBTiles.</p><p>Here I recommend some tools that help you convert data formats.</p><p><strong>To MBTiles:</strong></p><p><a href="https://www.mapbox.com/mapbox-studio-classic/">Mapbox Studio Classic</a><br>Although Mapbox is branding their new Mapbox Studio, the old one, Mapbox Studio Classic, turns out to be a better choice if you want to create MBTiles and host it by yourself. You can add different types of data sources or link it to your PostGIS or SQLite database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*WcsWcLWCrAqHJkaua8cuFA.png" /><figcaption>Adding a datasource in Mapbox Studio Classic</figcaption></figure><p>After importing data, you can find the option to export data to MBTiles in “Settings”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*wWlu1o3GtDtLYts52G81ZA.png" /></figure><p><a href="https://github.com/mapbox/tippecanoe">Mapbox Tippecanoe</a><br>Mapbox has a command line tool called Tippecanoe. It is now only compatible with Mac OS and Linux. If you are a Windows user, you can use Mapbox Studio Classic as an alternative. I found two useful tutorials that help you easily master Tippecanoe：<a href="https://github.com/mapbox/tippecanoe">Tippecanoe on Github</a> and a <a href="https://www.mapbox.com/help/large-data-tippecanoe/">Mapbox help section</a></p><p>In addition to creating MBTiles, Tippecanoe also provides options like styling data, tile-join, and decode MBTiles.</p><p>You may also find that using Tippecanoe to create MBTiles is much faster than using Mapbox Studio Classic. For Mac users, I recommend Tippecanoe.</p><p><strong>To GeoJSON/Shapefile/KML/…:</strong></p><p><a href="http://www.gdal.org/ogr2ogr.html">Ogr2ogr</a><br>Ogr2ogr is a powerful tool that helps you convert data between a variety of formats. I usually use it to convert data to GeoJSON. I also use it to convert GeoJSON or Shapefile to PostGIS. Sometimes, the size of a GeoJSON or a Shapefile is so large that it makes Mapbox Studio Classic crash. You can convert the data to PostGIS and import data from PostGIS to Mapbox Studio Classic.</p><p>I also found a <a href="http://ogr2gui.ca/">GUI</a> of it. You can use it without any coding.</p><p><strong>Step 2: Use </strong><a href="https://github.com/spatialdev/PGRestAPI"><strong>PGRestAPI</strong></a><strong> to build a spatial server</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*x4SucxF2JY9FYZaboCxkmA.png" /></figure><p>PGRestAPI (a.k.a Chubbs Spatial Server) is a Node.js REST API for PostgreSQL Spatial Tables. It can host MBTiles, Shapefile, and GeoJSON.</p><p>You can either install it as a local host or install it on <a href="https://aws.amazon.com/">AWS</a>. I failed to install it locally on a PC so I created a Ubuntu Server 14.04 LTS instance on AWS. Why Ubuntu 14.04? I found PGRestAPI works better in an older operating system with an older version of Mapnik, Node, PostgreSQL and PostGIS. Pretty strange, right? I guess PGRestAPI has not been updated since long ago so it is not compatible with those new versions of dependencies.</p><p>Anyway, if you follow my instructions, I can assure you to get PGRestAPI work.</p><p>First, you need to create a Ubuntu Server 14.04 LTS instance on AWS. It is eligible for free tier so you may use it for free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p10EiOZm5lw51eLcIOYDcw.png" /></figure><p>After launching the instance, you need to find a way to connect your Linux instance. You can find detailed tutorial <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html">here</a>.</p><p>Once you manage to connect to your Linux instance. You can follow the <a href="https://github.com/spatialdev/PGRestAPI/blob/master/docs/Ubuntu_Install.md">installation guide</a> for Ubuntu to install PGRestAPI. Just copy paste these command lines and you will get PGRestAPI installed.</p><p>The next step is uploading data to the spatial server. For Linux/Unix/Mac system, you can use a command-line tool called “scp” to transfer files. You can find documentation <a href="http://angus.readthedocs.io/en/2014/amazon/transfer-files-between-instance.html">here</a>. For Windows system, you can use a <a href="https://winscp.net/eng/download.php">GUI</a> called “WinSCP”. Once you get scp or WinSCP, you can upload your MBTiles to /PGRestAPI/data/pbf_mbtiles. Note that “pbf_mbtiles” folder is for vector tiles, “png_mbtiles” folder is for raster tiles, “rasters” folder is for GeoTIFF, and “shapefiles” folder is for Shapefiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*x6sX5rH0kp_jSo2pyVPsyA.png" /><figcaption>Screenshot of WinSCP</figcaption></figure><p>Now you need to stop the Chubbs Spatial Server and restart it. You can request vector MBTiles from the URL:</p><p><a href="http://your/">http://your</a> instance’s IP address:3001/services/vector-tiles/your file name/{z}/{x}/{y}.pbf</p><p>You can request raster MBTiles from the URL:</p><p><a href="http://your/">http://your</a> instance’s IP address:3001/services/tiles/your file name/{z}/{x}/{y}.png</p><p>You can create a https url and direct it to the http url so that you can avoid mixed content errors.</p><p>That’s how I create MBTiles and host it by PGRestAPI. If you meet any difficulties when creating MBTiles or installing PGRestAPI, please feel free to ask in responses.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40c41f94f5ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>