Trying to resolve this issue, I adjusted the geoJsonURL to handle a more intricate shape. Despite the new shape allowing the zoom method to function correctly, the shape itself appears completely distorted. Based on the Coordinate system: WGS 84 (EPSG:4326) and insights from this discussion on Stack Overflow, it should resemble what I currently have in order to calculate the correct projection. However, the output is still presenting an odd path.
Any assistance would be greatly appreciated, Thank you in advance.
The original topic is below with the new part added above
I attempted to zoom in on the path, but the scale method did not seem to have any effect. I also tried using the pointRadius method as suggested in some discussions, but that didn't help either. As you can see, the path is nearly centered (manually translated), yet very small. What am I missing with my approach?
I have access to the coordinate system and box coordinates (not included in this example) if necessary. Despite going through various examples, nothing seems to work. Any ideas on what could be going wrong? Coordinate system: WGS 84 (EPSG:4326)
Thank you in advance
/* geometryType=esriGeometryPolyline OR esriGeometryMultipoint OR esriGeometryPolygon OR esriGeometryEnvelope*/
const geoJsonURL = "https://sig.cm-figfoz.pt/arcgis/rest/services/Internet/MunisigWeb_DadosContexto/MapServer/2/query?f=geojson&where=(LOWER(NOME)%20LIKE%20LOWER(%27%25Alhadas%25%27))&returnGeometry=true&geometryType=esriGeometryPolyline&spatialRel=esriSpatialRelIntersects&outFields=*&outSR=3763"
const canvas = d3.select("#map").append("svg")
.attr("width", 500)
.attr("height", 500)
.style("border", "2px solid red");
const projection = d3.geoTransverseMercator()
.rotate([8.1331, 0])
.center([0, 39.6682])
.scale(200)
.translate([300, 350]);
const path = d3.geoPath().projection(projection);
const group = canvas.append("g")
d3.json(geoJsonURL).then(function (data) {
group.selectAll("g")
.data(data.features)
.enter()
.append("path")
.attr("stroke", "blue")
.attr("stroke-width", 1)
.attr("fill", "none")
.attr("d", path);
//.attr("d", path.pointRadius(20));
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<body>
<div id="map"></div>
</body>