GeoServer (v2.5.2) 및 GeoWebcache를 사용하는 프로젝트에서 작업하고 있습니다. 커버리지 스토어와 관련 레이어를 만들기 위해 이미지를 업로드하고 싶습니다. PHP와 cURL을 사용하여 REST API와 통신하고 있습니다. GeoServer - REST API를 사용하여 레이어 추가 (PHP 사용)
업로드 및 커버리지 저장소의 생성
이 코드를 사용하여 작동 :$curl = curl_init($service_url."workspaces/".htmlentities($workspace)."/coveragestores");
$data = '<coverageStore>
<name>'.htmlentities($name).'</name>
<type>'.htmlentities($type).'</type>
<enabled>true</enabled>
<connectionParameters>
<entry key="url">file:'.$file.'</entry>
<entry key="namespace">'.htmlentities($workspace, ENT_COMPAT).'</entry>
</connectionParameters>
</coverageStore>';
curl_setopt($curl, CURLOPT_POST, True);
curl_setopt($curl, CURLOPT_HTTPHEADER,array("Content-type: application/xml, Content-Length: ".strlen($data)));
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_USERPWD, $auth);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$buffer = curl_exec($curl);
가 지금은 새 레이어를 만들려고합니다. 위와 동일한 코드를 사용하고 있습니다 (URL 및 XML 매개 변수 만 변경). 내가 찾은
최고 "문서는"이 하나입니다 GeoWebCache와 GeoServer 버전을 사용하려고 http://docs.geoserver.org/2.5.x/en/user/geowebcache/rest/layers.html , 모두가 나에게 404 오류 코드를 반환합니다.
그래서이 문서를 사용하여 다시 시도했습니다 : http://docs.geoserver.org/2.5.x/en/user/rest/api/layers.html 그러나 POST 매개 변수가 무엇인지 예상하지는 않습니다. 내가 얻는 유일한 것은 500 오류 코드입니다. 내가 잘못 뭐하는 거지
? 고마워.