Skip to content

Commit b8fda44

Browse files
authored
Update README.md
java调用geocoding样例
1 parent 2acf839 commit b8fda44

File tree

1 file changed

+136
-1
lines changed

1 file changed

+136
-1
lines changed

README.md

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,142 @@ Address(
185185

186186
[Change Log](./CHANGES.md)
187187
## java调用
188-
188+
1.导入依赖
189+
<dependency>
190+
<!-- 从1.2.0开始迁移到bitlap,原groupId: io.patamon.geocoding -->
191+
<groupId>org.bitlap</groupId>
192+
<artifactId>geocoding</artifactId>
193+
<version>1.3.1</version>
194+
</dependency>
195+
2.除了导入上面这个依赖还需要导入以下依赖不然运行的话会报错
196+
<properties>
197+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
198+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
199+
<java.version>1.8</java.version>
200+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
201+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
202+
<kotlin.version>1.6.10</kotlin.version>
203+
<dokka.version>1.6.0</dokka.version>
204+
<lucene.version>8.5.2</lucene.version>
205+
<word.version>1.3</word.version>
206+
<gson.version>2.9.0</gson.version>
207+
<ik.analyzer.version>2012_u6</ik.analyzer.version>
208+
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
209+
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
210+
</properties>
211+
<dependency>
212+
<groupId>org.jetbrains.kotlin</groupId>
213+
<artifactId>kotlin-stdlib</artifactId>
214+
<version>${kotlin.version}</version>
215+
</dependency>
216+
<dependency>
217+
<groupId>com.google.code.gson</groupId>
218+
<artifactId>gson</artifactId>
219+
<version>${gson.version}</version>
220+
</dependency>
221+
222+
<dependency>
223+
<groupId>commons-io</groupId>
224+
<artifactId>commons-io</artifactId>
225+
<version>2.11.0</version>
226+
<scope>test</scope>
227+
</dependency>
228+
<dependency>
229+
<groupId>com.google.guava</groupId>
230+
<artifactId>guava</artifactId>
231+
<version>31.1-jre</version>
232+
<scope>test</scope>
233+
</dependency>
234+
235+
<dependency>
236+
<groupId>org.jetbrains.kotlin</groupId>
237+
<artifactId>kotlin-test-junit</artifactId>
238+
<version>${kotlin.version}</version>
239+
<scope>test</scope>
240+
</dependency>
241+
<dependency>
242+
<groupId>junit</groupId>
243+
<artifactId>junit</artifactId>
244+
<version>4.13.2</version>
245+
<scope>test</scope>
246+
</dependency>
247+
<dependency>
248+
<groupId>mysql</groupId>
249+
<artifactId>mysql-connector-java</artifactId>
250+
<version>8.0.28</version>
251+
<scope>test</scope>
252+
</dependency>
253+
254+
<!-- lucene -->
255+
<!--
256+
<dependency>
257+
<groupId>org.apache.lucene</groupId>
258+
<artifactId>lucene-queryparser</artifactId>
259+
<version>${lucene.version}</version>
260+
</dependency>
261+
<dependency>
262+
<groupId>org.apache.lucene</groupId>
263+
<artifactId>lucene-analyzers-smartcn</artifactId>
264+
<version>${lucene.version}</version>
265+
</dependency>
266+
-->
267+
<!--
268+
<dependency>
269+
<groupId>org.apdplat</groupId>
270+
<artifactId>word</artifactId>
271+
<version>${word.version}</version>
272+
<exclusions>
273+
<exclusion>
274+
<groupId>org.apache.lucene</groupId>
275+
<artifactId>lucene-core</artifactId>
276+
</exclusion>
277+
<exclusion>
278+
<groupId>org.apache.lucene</groupId>
279+
<artifactId>lucene-queryparser</artifactId>
280+
</exclusion>
281+
<exclusion>
282+
<groupId>org.apache.lucene</groupId>
283+
<artifactId>lucene-analyzers-common</artifactId>
284+
</exclusion>
285+
</exclusions>
286+
</dependency>
287+
-->
288+
<dependency>
289+
<groupId>com.janeluo</groupId>
290+
<artifactId>ikanalyzer</artifactId>
291+
<version>${ik.analyzer.version}</version>
292+
<exclusions>
293+
<exclusion>
294+
<groupId>org.apache.lucene</groupId>
295+
<artifactId>lucene-core</artifactId>
296+
</exclusion>
297+
<exclusion>
298+
<groupId>org.apache.lucene</groupId>
299+
<artifactId>lucene-queryparser</artifactId>
300+
</exclusion>
301+
<exclusion>
302+
<groupId>org.apache.lucene</groupId>
303+
<artifactId>lucene-analyzers-common</artifactId>
304+
</exclusion>
305+
</exclusions>
306+
</dependency>
307+
 3.接下来写代码
308+
309+
package cn.xiaow.test;
310+
311+
import org.bitlap.geocoding.GeocodingX;
312+
import org.bitlap.geocoding.model.Address;
313+
314+
public class GeocodingDemo {
315+
public static void main(String[] args) throws Exception{
316+
GeocodingX geocodingX = new GeocodingX();
317+
Address address = geocodingX.normalizing("广东省广州市花都区新华街新都大道68号馨庭花园");
318+
System.out.println(address);
319+
}
320+
}
321+
322+
323+
189324
## LICENSE
190325

191326
MIT

0 commit comments

Comments
 (0)