如何从GRTgaz法国输气网SVG瓦片地图提取WMS/WMTS底层数据?
Got it, let's walk through practical ways to get at the underlying WMS/WMTS data behind GRTgaz's SVG-tiled map—since those SVG tiles are just a rendered layer, there's often a standard geospatial service hiding underneath. Here's what you can try:
Inspect Network Requests with Browser DevTools
Fire up your browser's DevTools (hit F12), switch to the Network tab, then refresh the map page. Filter requests byXHRorFetchand look for any calls that hint at OGC standard services:- Keep an eye out for URLs containing
/wms,/wmts, or parameters likeservice=WMS,request=GetMap, ortilematrixset(a WMTS-specific term). Sometimes the SVG tiles are just a front-end wrapper, and the raw WMS/WMTS requests are happening in the background. - Check the request headers and response bodies—you might find the full WMS/WMTS endpoint tucked away there.
- Keep an eye out for URLs containing
Parse SVG Tile Geometry and Coordinates
The SVG snippet you shared includes atransformmatrix anddata-geometry-typeattribute, which are clues to coordinate mapping:- Extract the path data (
dattribute) from SVG elements (like pipes, stations) if they're vector-based. Use tools like Python'ssvgpathtoolsto parse these paths. - Use the
transformmatrix to convert SVG pixel coordinates to the map's underlying spatial reference system (likely something like EPSG:2154 for France). Libraries likepyprojcan handle the projection conversion to get real-world geographic coordinates.
- Extract the path data (
Check for Official Open Data or API Access
GRTgaz, as a major gas infrastructure operator, might offer official open data channels you haven't found yet:- Look for a "Données ouvertes" (Open Data) section on their website—they may publish the gas network data as GeoJSON, Shapefile, or even expose a public WMS/WMTS service directly.
- Reach out to their technical support or data team. Many public-facing utilities are willing to provide access to standard geospatial services for legitimate use cases.
Reverse-Engineer SVG Tile Naming/Generation Logic
If all else fails, analyze how the SVG tiles are structured:- Note the tile URL pattern (e.g.,
https://example.com/tiles/{zoom}/{x}/{y}.svg). This often mirrors WMTS tile indexing. You can try modifying the URL to point to a potential WMTS endpoint (swap.svgfor.pngor check for a/wmtspath prefix). - Use tools like
t-rexorgdal_translateto convert SVG tiles back to raster formats, then stitch them into a single dataset—but this is a last resort since it won't give you the raw vector data from a WMS/WMTS.
- Note the tile URL pattern (e.g.,
Important: Always review GRTgaz's terms of service before extracting or using their data. Infrastructure data may have copyright restrictions or require explicit permission for commercial use.
内容的提问来源于stack exchange,提问作者pickenpack

