I can use the data in the GeoServer from the JSON file, but I cannot use it directly from the GeoServer. I can get data as WMS I'm using allow CORS as a Chrome extension (no CORS issues either).

import { MapContainer, TileLayer, GeoJSON, Popup, LayersControl, LayerGroup, WMSTileLayer } from 'react-leaflet'
import 'leaflet/dist/leaflet.css'
import React, { useEffect, useState } from 'react'
import axios from 'axios'
import ParselService from '../services/ParselService'
import Data from '../services/data.json'

export default function MapComp() { 
    const [parseller,setParseller]=useState([]);
    useEffect(() =>{
         const baseUrl="http://localhost:8081/geoserver/parseller/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=parseller%3ATUR_ADM0&maxFeatures=50&outputFormat=application%2Fjson"
            axios.get(baseUrl).then(resp =>setParseller(resp.data))
    const position = [39,35]
    const onEachParsel = (parsel,layer) => {
       // const parselName=parsel.properties.party;
    //    layer.bindPopup(parselName)
    return (
         {/* {Array.from(parseller,parsel =>{
         })} */}
        <MapContainer id="map" center={position} zoom={6}>
        <LayersControl position="topright">
                attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
      <LayersControl.Overlay checked name="Evler">

      <LayersControl.Overlay checked name="Parseller">
  • So what goes wrong? Geojson is a native format for wfs in geoserver
    – Ian Turton
    Aug 28 at 17:11
  • I guess the incoming data stays under the tilelayer because if I comment the tilelayer, the data appears. I used zindex but it didn't work
    – Giray
    Aug 28 at 18:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.